• Stars
    star
    791
  • Rank 55,290 (Top 2 %)
  • Language
    Ruby
  • License
    Other
  • Created over 14 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby Facets

Ruby Facets

Gem Version Build Status Β  Β  Flattr Me

"ALL YOUR BASE ARE BELONG TO RUBY"

Introduction

Ruby Facets is the premiere collection of general purpose method extensions and standard additions for the Ruby programming language.

Facets houses the largest single collection of methods available for extending the core capabilities of Ruby's built-in classes and modules. This collection of extension methods are unique by virtue of their atomicity. The methods are stored in individual files so that each can be required independently. This gives developers the potential for much finer control over which extra methods to bring into their code.

In addition Facets provides a collection of extensions to Ruby standard library plus a small collection of add-on classes and modules. Together these libraries constitute an reliable source of reusable components, suitable to a wide variety of usecases.

Resources

Documentation

Facets has special documentation needs due to its extensive breadth. The documentation generated when installing via RubyGems, or the YARD docs provided by rubydoc.info can be somewhat unwieldy because it combines all of Facets in one large set. When using these resources, it is important to remain aware of the source location of particular methods.

For better organized online documentation, generated to separate core extensions from standard libraries, see the Learn Facets page on the website for links to available documentation.

Installation

Bundler

If you are using Bundler with your project, add the facets gem to the project's Gemfile. Unless you want all of facets loaded be sure to add the :require => false option.

gem "facets", require: false

RubyGems

The easiest way to install is via RubyGems.

$ gem install facets

Setup.rb

Facets can be installed the old-fashioned way using Setup.rb. Download and unpack the .tar.gz package and run setup.rb, like so:

$ tar -xvzf facets-2.x.x.tar.gz
$ cd facets-2.x.x
$ sudo setup.rb

Facets 2.8+ requires Ruby 1.8.7 or higher. Facets 3.0+ requires Ruby 2.0.0 or higher.

Mission

Facets holds to the notion that the more we can reasonably integrate into a common foundation, directed toward general needs, the better that foundation will be able to serve the community. There are a number of advantages here:

  • Better Code-reuse
  • Collaborative Improvements
  • Greater Name Consistency
  • One-stop Shop and Installation

Usage

CORE Library

At the heart of Ruby Facets is the CORE extensions library. CORE provides a sizable collection of generally useful methods, along with a few supporting classes, that extend the functionality of Ruby's core classes and modules.

With the exception of a few uncommon extensions, CORE contains anything that will load automatically when issuing:

require 'facets'

This loads all the CORE functionality at once. If you plan to use more then a handful of Facets core methods it is recommended that you require the library in this way. However, you can also "cherry pick" the CORE library as you prefer. And for uncommon extensions this must be done. The general require statement for a core extension library is:

require 'facets/<class|module>/<method>'

For example:

require 'facets/time/stamp'

Most "atoms" contain only one method, but exceptions occur when methods are closely tied together.

You can load per-class or per-module groups of core methods by requiring the class or module by name. For example"

require 'facets/time'

Will require all the core Time method extensions.

Note that some methods that were part of CORE in 1.8 and earlier are now part of MORE libraries. A good example is 'random.rb'. There were separated because they had more specialized use cases, where as CORE extensions are intended as general purpose.

Method File Names

Operator method redirect files are stored using English names. For instance Proc#* is proc/op_mul.

For reference, here is the chart.

 +@   => op_plus
 -@   => op_minus
 +    => op_add
 -    => op_sub
 **   => op_pow
 *    => op_mul
 /    => op_div
 %    => op_mod
 ~    => op_tilde
 <=>  => op_cmp
 <<   => op_lshift
 >>   => op_rshift
 <    => op_lt
 >    => op_gt
 ===  => op_case
 ==   => op_equal
 =~   => op_apply
 <=   => op_lt_eq
 >=   => op_gt_eq
 |    => op_or
 &    => op_and
 ^    => op_xor
 []=  => op_store
 []   => op_fetch

Facets simply takes the '*' and translates it into a string acceptable to all file systems. Also, if a method ends in '=', '?' or '!' it is simply removed.

MORE Library (aka Standard Library)

On top of the extensive CORE library, Facets provides extensions for Ruby's standard library, as well as a small collection of additional modules and classes to supplement it.

Use this library like you would any other 3rd party library. The only difference between Facet's Standard library and other libraries is the lack of any enclosing Facets:: namespace.

When using Facets extended versions of Ruby's standard libraries, the libraries have to loaded individually. However you do not need to load Ruby's library first, as the Facets' library will do that automatically.

For example, normally one load Ruby's OpenStruct class via:

require 'ostruct'

To load 'ostruct.rb' plus Facets extensions for it simply use:

require 'facets/ostruct'

For details pertaining to the functionality of each feature, please see the API documentation.

Contribute

This project thrives on contribution!

If you have any extension methods, classes or modules that you think have very general applicability and would like to see them included in this project, don't hesitate to submit. Also, if you have better versions of any thing already included or simply have a patch, they are more than welcome. We want Ruby Facets to be of the highest quality.

Development

Facets uses the Lemon testing framework to handle unit testing, while QED specifications provide tested documentation.

Facets uses Detroit and Rulebow build tools. Detroit is a life-cycle tool and Rulebow is a continuous integration tool. These tools, via the Assembly and Rulebook scripts respectively, sometimes use other tools such as Mast and Indexer. In addition we support Rake and Guard build tools, which most developers are familiar with. Note, that while these build tools can be easy circumvented, the Mast and Indexer tools are necessary to prepare Facets for release.

Authors

Much of this collection was written and/or inspired by a variety of great Ruby developers. Fortunately nearly all utilized works were copyrighted under the same open licenses, the Ruby License or the more liberal BSD and MIT licenses. In the one or two exceptions the copyright notice has been included with the source code. We have since received permission from the various authors to normalize the licensing to a single license. For this purpose we have chosen the BSD 2 Clause License. This is the license Ruby itself now uses, so it seemed the most appropriate choice. It is also almost identical to the MIT license. Any code file not specifically labeled otherwise shall fall under the this license (which is BSD 2-clause).

In all cases, every effort has been made to give credit where credit is due. You will find these acknowledgments embedded in the source code. You can see them in "CREDIT:" and/or "@author" lines. Also see the Contributors page on the Wiki for a list of all contributing Rubyists. If anyone is missing from the list, please let us know so we can correct. Thanks.

This collection was put together by, and much of it written by trans. If need be, he can be reached via email at transfire at gmail.com.

License

The collection PER COLLECTION is licensed as follows:

Ruby Facets
Copyright (c) 2005 Rubyworks

Distributed under the terms of the BSD-2 License (same as Ruby license).

The BSD 2 Clause License is a simple open source license. The complete text of the license accompany this document (see the enclosed LICENSE file).

Acknowledgments and Copyrights for particular snippets of borrowed code are given in their respective source. At this point, all licensing has been normalized for all included code. Original authors have given permission for inclusion of their code under such license, with appropriate credit citations.

"ALL YOUR BASE ARE BELONG TO RUBY!"

Ruby Facets, Copyright (c) 2005 Rubyworks

Do you Ruby? (http://ruby-lang.org)

More Repositories

1

ansi

Set of ANSI Code based classes and modules for Ruby
Ruby
118
star
2

clik

Kernel#cli
Ruby
98
star
3

smeagol

Read-Only Gollum Server
Ruby
92
star
4

pqueue

Priority Queue in pure Ruby
Ruby
69
star
5

hashery

Facets Hashery Collection of Hash-based classes
Ruby
58
star
6

radix

Base Conversions
Ruby
55
star
7

tapout

TAP-Y/J Test Harness
Ruby
53
star
8

dnote

Extract Developers Notes from Source
Ruby
44
star
9

ostruct2

OpenStruct Improved
Ruby
41
star
10

xdg

XDG Base Directory Standard Library for Ruby
Ruby
39
star
11

instance

Slick Object Instance API
Ruby
37
star
12

dci

Experiment in DCI for Ruby
Ruby
34
star
13

qed

Quality Ensured Documentation
Ruby
32
star
14

english

English language support library
Ruby
31
star
15

yard-tomdoc

Implements TomDoc syntax markup for YARD
Ruby
31
star
16

paramix

Parmetric Mixins
Ruby
25
star
17

yaml_command

YAML Command
Ruby
22
star
18

autoreload

Automatic Library Reloading
Ruby
17
star
19

setup

Ruby's Classic Site Installer
Ruby
15
star
20

executable

Add a CLI to any class instantly
Ruby
15
star
21

malt

My Milkshake is Better than Yours
Ruby
13
star
22

neapolitan

"Kid in the Candy Store" Template Engine
Ruby
12
star
23

vclog

Cross-SCM Changelog Generator
Ruby
11
star
24

locat

LOCat
Ruby
10
star
25

functor

Higher Order Functions for Ruby
Ruby
10
star
26

htmlfilter

Clean HTML/CSS
Ruby
9
star
27

minitap

TAP-Y/J Output Formats for MiniTest
Ruby
9
star
28

platypus

Ruby Knows Types
Ruby
9
star
29

lemon

Pucker-Strength Unit Testing
Ruby
9
star
30

rspec-ontap

RSpec On Tap-Y/J
Ruby
8
star
31

cuts

Cut-based AOP for Ruby
Ruby
7
star
32

ae

Assertive Expressive
Ruby
7
star
33

versus

Best-of-Breed Version Class Library
Ruby
7
star
34

crypt3

Unix Crypt 3 in Ruby
Ruby
7
star
35

regex

Regular Expressions on the Clamshell
Ruby
7
star
36

ragtag

Ruby Template Attribute Language
Ruby
6
star
37

loadable

Customize Ruby's load system easily with load wedges.
Ruby
6
star
38

tomparse

TomDoc Parser
Ruby
6
star
39

brite

Brite is "Web Write"
Ruby
5
star
40

stick

Scientific Toolkit with SI Units System for Ruby
Ruby
5
star
41

richunits

Units System (like Rails)
Ruby
5
star
42

rundown

Javascript RDoc Parser
JavaScript
5
star
43

carats

Facets in C
C
5
star
44

finder

File finder for searching Gems, Rolls and Site locations
Ruby
5
star
45

reusing

Transform core extensions into refinements
Ruby
4
star
46

shelob

Static site generator extension for Smeagol
Ruby
4
star
47

yard-bird

Custom YARD Documentation
Ruby
4
star
48

ratch

Ruby Batch Scripts
Ruby
4
star
49

anise

Dynamic Annotations System for Ruby
Ruby
4
star
50

capsule

Encapsulate Ruby Scripts
Ruby
3
star
51

fileutils2

FileUtils refactored
Ruby
3
star
52

rc

The best way to manage your tool configurations.
Ruby
3
star
53

backload

Shouldn't loading have a callback?
Ruby
3
star
54

rubyfaux

Shomen HTML browser with Old-School Ruby Style ||
JavaScript
2
star
55

cli_base

Killer Commandlines
Ruby
2
star
56

history

HISTORY File Parser
Ruby
2
star
57

spectroscope

RSpec style BDD on RubyTest
Ruby
2
star
58

readme

Extract useful information from README files
Ruby
2
star
59

be

Behaviorial Expectations
Ruby
2
star
60

rdoc-shomen

RDoc generator for producing Shomen documentation
Ruby
2
star
61

r4x

E4X for Ruby
Ruby
2
star
62

yes

YAML Easy Schemas
Ruby
2
star
63

iteration

unified iterator
Ruby
2
star
64

rulebow

Autological Build Tool
Ruby
2
star
65

rubytest

Core API for Ruby Universal Test Harness
Ruby
2
star
66

microtest

Microminal Test::Unit/MiniTest Compatible Test Framework
Ruby
2
star
67

mixers

Collection of mixin modules for Ruby
Ruby
2
star
68

brass

Bare-Metal Ruby Assertions System Standard
Ruby
2
star
69

shomen-server

Real-time Documentation Server
Ruby
2
star
70

quarry

Tending Project Ecology
Ruby
2
star
71

smeagol-test

Wiki used to test Smeagol
1
star
72

shomen-yard

Shomen via YARD
Ruby
1
star
73

realms

Ruby Enhanced Library Management System
Ruby
1
star
74

proutils

Project Utility Modules and Methods
Ruby
1
star
75

strmask

String::Mask provides a kind-of String Algebra
Ruby
1
star
76

brite-site

Brite Site Starter Kit!
JavaScript
1
star
77

path

All Things Pathy
Ruby
1
star
78

live

Facets Live! It's raining APIs!
Ruby
1
star
79

bezel

The Any Version Load System
Ruby
1
star
80

pic

Cobol-like Picture Pattern Matching
Ruby
1
star
81

rebecca

Lovely Shomen Documentation Browser
JavaScript
1
star
82

assay-minitest

MiniTest Assertions and Expectations on Assay
Ruby
1
star
83

opendsl

Simple Open Nomencalture DSL System
Ruby
1
star
84

xoxo

XOXO for Ruby
Ruby
1
star
85

enumargs

Enumerable::Arguments
Ruby
1
star
86

fluidity

Fluid Validity Assertions Grammer
Ruby
1
star
87

assay

Class-based Assertions Framework
Ruby
1
star
88

yard-qed

QED plugin for YARD
Ruby
1
star
89

yard-notes

If I want to know I'll ask
Ruby
1
star
90

no_backsies

Enhanced Ruby Callback System
Ruby
1
star
91

bang

Bang! Bang! Your dead! (Yet another Assertions Framework)
Ruby
1
star
92

rspecial

RSpec Matchers on Assay
Ruby
1
star
93

assay-testunit

TestUnit Assertions on Assay
Ruby
1
star
94

lime

Ghirken-style Pure Ruby Test Framework
Ruby
1
star
95

plugin

Simple plugin handler for Ruby (not Rails)
Ruby
1
star
96

rubyworks.github.com

Rubyworks Main Website
JavaScript
1
star
97

bicrypt

Simple Bidirectional Cryptography
Ruby
1
star
98

gemdo

Ruby Project Object Model
Ruby
1
star
99

erbside

Inline ERB templating tool
Ruby
1
star
100

raml

Ruby Ambidextrous Metadata Language
Ruby
1
star