facets 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/HISTORY.rdoc +135 -294
  2. data/MANIFEST +40 -91
  3. data/NOTES +1 -1
  4. data/README.rdoc +10 -8
  5. data/Rakefile +11 -34
  6. data/demo/{hook.rd → hook.rdoc} +2 -0
  7. data/demo/{scenario_require.rd → scenario_require.rdoc} +3 -0
  8. data/lib/core/facets-live.rb +7 -5
  9. data/lib/core/facets.rb +379 -359
  10. data/lib/core/facets/array/conjoin.rb +2 -2
  11. data/lib/core/facets/array/pad.rb +1 -1
  12. data/lib/core/facets/array/recursively.rb +2 -2
  13. data/lib/core/facets/array/splice.rb +1 -1
  14. data/lib/core/facets/binding/caller.rb +2 -4
  15. data/lib/core/facets/comparable/comparable.rb +2 -2
  16. data/lib/core/facets/dir/ascend.rb +3 -0
  17. data/lib/core/facets/dir/recurse.rb +4 -0
  18. data/lib/core/facets/duplicable.rb +6 -8
  19. data/lib/core/facets/enumerable/count.rb +22 -13
  20. data/lib/core/facets/enumerable/map_detect.rb +28 -0
  21. data/lib/core/facets/enumerable/mash.rb +13 -5
  22. data/lib/core/facets/enumerable/per.rb +3 -1
  23. data/lib/core/facets/hash/count.rb +14 -0
  24. data/lib/core/facets/hash/data.rb +14 -0
  25. data/lib/core/facets/kernel/__method__.rb +1 -1
  26. data/lib/core/facets/kernel/d.rb +9 -8
  27. data/lib/core/facets/kernel/eigenclass.rb +20 -0
  28. data/lib/core/facets/kernel/extend.rb +10 -0
  29. data/lib/core/facets/kernel/instance_class.rb +1 -0
  30. data/lib/core/facets/kernel/instance_variables.rb +6 -6
  31. data/lib/core/facets/kernel/meta_alias.rb +18 -0
  32. data/lib/core/facets/kernel/meta_class.rb +17 -0
  33. data/lib/core/facets/kernel/meta_def.rb +18 -0
  34. data/lib/core/facets/kernel/meta_eval.rb +18 -0
  35. data/lib/core/facets/kernel/object_hexid.rb +21 -6
  36. data/lib/core/facets/kernel/object_state.rb +4 -2
  37. data/lib/core/facets/kernel/populate.rb +3 -1
  38. data/lib/core/facets/kernel/with.rb +1 -1
  39. data/lib/core/facets/metaid.rb +6 -93
  40. data/lib/core/facets/module/class_def.rb +2 -0
  41. data/lib/core/facets/module/extend.rb +10 -11
  42. data/lib/core/facets/module/is.rb +5 -5
  43. data/lib/core/facets/module/module_def.rb +31 -0
  44. data/lib/core/facets/string/camelcase.rb +14 -12
  45. data/lib/core/facets/string/cleanlines.rb +35 -0
  46. data/lib/core/facets/string/edit_distance.rb +62 -0
  47. data/lib/core/facets/string/indent.rb +86 -4
  48. data/lib/core/facets/string/index_all.rb +24 -0
  49. data/lib/core/facets/string/lines.rb +3 -6
  50. data/lib/core/facets/string/margin.rb +2 -1
  51. data/lib/core/facets/string/newlines.rb +35 -0
  52. data/lib/core/facets/string/op_div.rb +14 -0
  53. data/lib/core/facets/string/range.rb +2 -22
  54. data/lib/core/facets/string/range_all.rb +1 -0
  55. data/lib/core/facets/string/range_of_line.rb +1 -0
  56. data/lib/core/facets/string/similarity.rb +92 -0
  57. data/lib/core/facets/string/start_with.rb +6 -6
  58. data/lib/core/facets/string/titlecase.rb +1 -1
  59. data/lib/more/facets/basicobject.rb +16 -15
  60. data/lib/more/facets/blankslate.rb +8 -0
  61. data/lib/more/facets/class_extend.rb +126 -1
  62. data/lib/more/facets/continuation.rb +53 -54
  63. data/lib/more/facets/dictionary.rb +9 -63
  64. data/lib/more/facets/erb.rb +63 -0
  65. data/lib/more/facets/filelist.rb +5 -5
  66. data/lib/more/facets/hashbuilder.rb +101 -0
  67. data/lib/more/facets/inheritor.rb +36 -45
  68. data/lib/more/facets/ini.rb +267 -0
  69. data/lib/more/facets/instance_eval.rb +4 -4
  70. data/lib/more/facets/ioredirect.rb +7 -60
  71. data/lib/more/facets/linkedlist.rb +195 -0
  72. data/lib/more/facets/matcher.rb +140 -0
  73. data/lib/more/facets/memoizer.rb +64 -0
  74. data/lib/more/facets/methodspace.rb +9 -4
  75. data/lib/more/facets/module/class_extend.rb +2 -121
  76. data/lib/more/facets/ostruct.rb +9 -9
  77. data/lib/more/facets/pathlist.rb +1 -9
  78. data/lib/more/facets/pathname.rb +11 -4
  79. data/lib/more/facets/plugin_manager.rb +50 -0
  80. data/lib/more/facets/random.rb +25 -3
  81. data/lib/more/facets/roman.rb +174 -0
  82. data/lib/more/facets/semaphore.rb +92 -0
  83. data/lib/more/facets/shellwords.rb +21 -48
  84. data/lib/more/facets/succ.rb +1 -1
  85. data/meta/{modified → released} +0 -0
  86. data/meta/repository +1 -0
  87. data/meta/suite +1 -0
  88. data/meta/version +1 -1
  89. data/script/conflicts +63 -0
  90. data/script/methods +49 -0
  91. data/test/core/binding/test_caller.rb +11 -4
  92. data/test/core/enumerable/test_count.rb +19 -10
  93. data/test/core/enumerable/test_map_detect.rb +75 -0
  94. data/test/core/enumerable/test_take.rb +1 -1
  95. data/test/core/kernel/test_object_hexid.rb +2 -1
  96. data/test/core/proc/test_to_method.rb +1 -1
  97. data/test/core/string/test_cleanlines.rb +11 -0
  98. data/test/core/string/test_indent.rb +66 -4
  99. data/test/core/string/test_lines.rb +2 -1
  100. data/test/core/string/test_newlines.rb +13 -0
  101. data/test/core/time/test_change.rb +1 -1
  102. data/test/core/time/test_stamp.rb +4 -7
  103. data/test/core/unboundmethod/test_name.rb +1 -1
  104. data/test/more/test_basicobject.rb +1 -20
  105. data/test/more/test_class_extend.rb +7 -0
  106. data/test/more/test_continuation.rb +8 -6
  107. data/test/more/test_inheritor.rb +12 -6
  108. data/test/more/test_random.rb +19 -10
  109. data/test/more/test_shellwords.rb +33 -0
  110. metadata +60 -31
  111. data/TODO +0 -5
  112. data/doc/README.core +0 -102
  113. data/doc/README.more +0 -61
  114. data/doc/manual/about.rb +0 -47
  115. data/doc/manual/annotations.rdoc +0 -60
  116. data/doc/manual/associations.rdoc +0 -55
  117. data/doc/manual/blockups.rdoc +0 -101
  118. data/doc/manual/capsule.rdoc +0 -34
  119. data/doc/manual/command.rdoc +0 -177
  120. data/doc/manual/core.rdoc +0 -37
  121. data/doc/manual/faq.rdoc +0 -32
  122. data/doc/manual/typecast.html +0 -112
  123. data/lib/more/facets/capsule.rb +0 -258
  124. data/lib/more/facets/coroutine.rb +0 -159
  125. data/lib/more/facets/enumerablepass.rb +0 -3
  126. data/lib/more/facets/fileable.rb +0 -162
  127. data/lib/more/facets/progressbar.rb +0 -253
  128. data/lib/more/facets/recorder.rb +0 -108
  129. data/meta/releases +0 -14
  130. data/test/more/test_coroutine.rb +0 -46
data/TODO DELETED
@@ -1,5 +0,0 @@
1
- = TODO List
2
-
3
- * generate phase should be in site pipeline.
4
-
5
-
@@ -1,102 +0,0 @@
1
- = Facets Core Library
2
-
3
- http://facets.rubyforge.com
4
-
5
- "ALL YOUR BASE ARE BELONG TO RUBY"
6
-
7
-
8
- == Introduction
9
-
10
- At the heart of Facets is the core extensions library. This a sizable collection
11
- of methods that augment Ruby's own core classes and modules.
12
-
13
-
14
- == Usage
15
-
16
- For detailed usage of any given method or module please refer to the API RDocs.
17
-
18
- http://facets.rubyforge.org/learn.html
19
-
20
- Most libraries are well documented. Assistance in improving documentation though is always appreciated.
21
-
22
- If you plan to use more then a few of Facets core method it is recommended that you require the main facility.
23
-
24
- require 'facets'
25
-
26
- This loads all the CORE functionality at once.
27
-
28
- Of course you can use the CORE library piecemeal if you prefer. The general require statement for a core extensions library is:
29
-
30
- require 'facets/<class|module>/<method-lib>'
31
-
32
- For example:
33
-
34
- require 'facets/time/stamp'
35
-
36
- Most "atoms" contain only one method, but a few exceptions occur when methods are closely tied together.
37
-
38
- You can load per-class or per-module groups of core methods by requiring the class or module by name. For example"
39
-
40
- require 'facets/time'
41
-
42
- Will require all the core Time method extensions.
43
-
44
- 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.
45
-
46
-
47
- == Method File Names
48
-
49
- Operator method redirect files are stored using English names. For instance for Proc#* is 'proc/op_mul'.
50
-
51
- For reference, here is the chart.
52
-
53
- +@ => op_plus_self
54
- -@ => op_minus_self
55
- + => op_plus
56
- - => op_minus
57
- ** => op_pow
58
- * => op_mul
59
- / => op_div
60
- % => op_mod
61
- ~ => op_tilde
62
- <=> => op_cmp
63
- << => op_lshift
64
- >> => op_rshift
65
- < => op_lt
66
- > => op_gt
67
- === => op_case_eq
68
- == => op_equal
69
- =~ => op_apply
70
- <= => op_lt_eq
71
- >= => op_gt_eq
72
- | => op_or
73
- & => op_and
74
- ^ => op_xor
75
- []= => op_store
76
- [] => op_fetch
77
-
78
- 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.
79
-
80
-
81
- == License
82
-
83
- The collection PER COLLECTION is licensed as follows:
84
-
85
- Ruby Facets
86
- Copyright (c) 2004-2006 Thomas Sawyer
87
-
88
- Distributed under the terms of the Ruby license.
89
-
90
- The Ruby license is a dual license that also provides for use of the GPL. Complete texts of both licenses accompany this document (see LICENSE).
91
-
92
- Acknowledgments and Copyrights for particular snippets of borrowed code are given in their respective source. All licenses are either compatible with the Ruby license (namely the GPL) or the original author has given permission for inclusion of their code under such license.
93
-
94
-
95
-
96
- ALL YOUR BASE ARE BELONG TO RUBY!
97
-
98
-
99
- Ruby Facets, Copyright (c)2005,2006,2007,2008 Thomas Sawyer
100
-
101
- Do you Ruby? (http://ruby-lang.org)
102
-
@@ -1,61 +0,0 @@
1
- = Facets More Library
2
-
3
- * http://facets.rubyforge.com
4
-
5
- "ALL YOUR BASE ARE BELONG TO RUBY"
6
-
7
-
8
- == Introduction
9
-
10
- On top of the extensive Core library, Facet provides a small collection
11
- of additional modules and classes, as well as extended versions of
12
- modules and classes in Ruby's Standard library.
13
-
14
-
15
- == Usage
16
-
17
- Use the More library like you would any other 3rd party library.
18
- The only difference between Facets More library and other libraries
19
- is the lack of any enclosing @Facets::@ namespace. This is becuase
20
- the libraries provided by Facets are considerd fairly low-level.
21
-
22
- When using Facets' extended versions of Ruby's standard libraries,
23
- the More libraries have to loaded manually, of course. However you
24
- do not need to load Ruby's library first, as the Facets' library
25
- will do that automatically.
26
-
27
- For example, normally one load Ruby's OpenStruct class via:
28
-
29
- require 'ostruct'
30
-
31
- To load 'ostruct.rb' plus Facets extensions for it simply use:
32
-
33
- require 'facets/ostruct'
34
-
35
- instead.
36
-
37
-
38
- == License
39
-
40
- The collection PER COLLECTION is licensed as follows:
41
-
42
- Ruby Facets
43
- Copyright (c) 2004-2006 Thomas Sawyer
44
-
45
- Distributed under the terms of the Ruby license.
46
-
47
- The Ruby license is a dual license that also provides for use of the GPL. Complete texts of both licenses accompany this document (see LICENSE).
48
-
49
- Acknowledgments and Copyrights for particular snippets of borrowed code are given in their respective source. All licenses are either compatible with the Ruby license (namely the GPL) or the original author has given permission for inclusion of their code under such license.
50
-
51
-
52
-
53
- "ALL YOUR BASE ARE BELONG TO RUBY!"
54
-
55
-
56
- Ruby Facets, Copyright (c)2005,2006,2007,2008 Thomas Sawyer
57
-
58
- Do you Ruby? (http://ruby-lang.org)
59
-
60
-
61
-
@@ -1,47 +0,0 @@
1
- # TomsLib - Tom's Ruby Support Library
2
- # Copyright (c) 2002 Thomas Sawyer, LGPL
3
- #
4
- # About
5
- # A plethora of modules, mixins and methods. Have fun!
6
-
7
- # TomsLib is free software; you can redistribute it and/or modify
8
- # it under the terms of the GNU Lesser General Public License as published by
9
- # the Free Software Foundation; either version 2 of the License, or
10
- # (at your option) any later version.
11
- #
12
- # TomsLib is distributed in the hope that it will be useful,
13
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- # GNU Lesser General Public License for more details.
16
- #
17
- # You should have received a copy of the GNU Lesser General Public License
18
- # along with TomsLib; if not, write to the Free Software
19
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
-
21
-
22
- module TomsLib
23
-
24
- TITLE = "TomsLib"
25
- RELEASE = "02.06.18"
26
- STATUS = "UCC"
27
- AUTHOR = "Thomas Sawyer"
28
- EMAIL = "transami@transami.net"
29
-
30
- Package = "#{TITLE}"
31
- Version = "v#{RELEASE} #{STATUS}"
32
- Copyright = "Copyright � 2002 #{AUTHOR}, #{EMAIL}"
33
-
34
- def self.about
35
- puts
36
- puts TomsLib::Package
37
- puts TomsLib::Version
38
- puts TomsLib::Copyright
39
- puts
40
- end
41
-
42
- end
43
-
44
- # Write about info to standerd out
45
- if $0 == __FILE__
46
- TomsLib.about
47
- end
@@ -1,60 +0,0 @@
1
- = Annotations
2
-
3
- A Complete In Code Annotations System
4
- by Trans and George Moschovitis
5
-
6
- http://facets.rubyforge.org
7
-
8
- == Synopsis
9
-
10
- Annotations provides a complete and easy to use system of annotating methods and arbitrary objects. The annotations are defined in-code,not in comments, so it is fully reflective without any preproccessing.
11
-
12
- == What's New
13
-
14
- This is Facets/Annotations first release as an independent project. As with all Facets' subprojects it is included in the complete facets package. So if you have 'facets' installed you do not need this.
15
-
16
- Version 2.0+ is a major simplification over 1.0 series. Overall speed is much faster and the notation more consistant. Where before one would use "ann.attr_name.ann_name", now it's ann(:attr_name, :ann_name). This change was inspired by Ara T. Howard.
17
-
18
- == Example
19
-
20
- class X
21
- attr :foo, String, :default => "bar"
22
- end
23
-
24
- X.ann :foo, :class #=> String
25
- X.ann :foo, :default #=> "bar"
26
-
27
- X.ann :foo, :default => "baz"
28
-
29
- X.ann :foo, :default #=> "baz"
30
-
31
- == Installation
32
-
33
- IMPORTANT! This library is included in the complete facets package. You do not this library if you already have facets installed.
34
-
35
- You can install either via gem or tarball.
36
-
37
- gem install facets_annotations
38
-
39
- or
40
-
41
- wget http://rubyforge.org/frs/download.php/18317/facets_annotations-2.0.0.tgz
42
- cd facets_annotations
43
- sudo ruby setup.rb
44
-
45
- == Documentation
46
-
47
- Please see doc/ directory for additional documentation.
48
-
49
- == Credit
50
-
51
- Trans [Implementation]
52
- George Moschovitis [Original Concept]
53
- Ara T. Howard [Suggestions]
54
-
55
- == License
56
-
57
- Copyright (c) 2004-2007 Thomas Sawyer, George Moschovitis
58
-
59
- Distributed under the Ruby/GPL dual-license.
60
-
@@ -1,55 +0,0 @@
1
- = Facets Structures
2
-
3
- http://facets.rubyforge.org
4
-
5
- Facets Structures is a collection of data structure libraries..
6
-
7
- == Libraries
8
-
9
- === Associations
10
-
11
- Gerenal binary association allows one object to be
12
- associated with another. It has a variety of uses,
13
- link-lists, simple ordered maps and mixed collections,
14
- among them.
15
-
16
- Associations can be used to draw simple relationships.
17
-
18
- :Apple >> :Fruit
19
- :Apple >> :Red
20
- :Apple.associations #=> [ :Fruit, :Red ]
21
-
22
- It can also be used for simple lists of ordered pairs.
23
-
24
- c = [ :a >> 1, :b >> 2 ]
25
- c.each { |k,v| puts "#{k} associated with #{v} }
26
-
27
- produces
28
-
29
- a associated with 1
30
- b associated with 2
31
-
32
- The method :>> is used to construct the association.
33
- It is a rarely used method so it is generally available.
34
- But you can't use an Association while extending
35
- any of the following classes becuase they use #>> for
36
- other things.
37
-
38
- Bignum
39
- Fixnum
40
- Date
41
- IPAddr
42
- Process::Status
43
-
44
-
45
- == Documentation
46
-
47
- Please see web/doc/ directory for additional documentation.
48
-
49
-
50
- == License
51
-
52
- Facets
53
- Copyright (c) 2004-2007 Thomas Sawyer
54
- Distributed under the Ruby/GPL dual-license.
55
-
@@ -1,101 +0,0 @@
1
- = Buildable
2
-
3
- Block builder system.
4
-
5
- by Trans
6
-
7
- http://facets.rubyforge.org
8
-
9
-
10
- == Synopsis
11
-
12
- Buildable provides a library for creating your own block builders.
13
-
14
-
15
- == Example
16
-
17
- require 'facets/buildable'
18
- require 'xmlhelper'
19
-
20
- module XMLHelper
21
- include Buildable
22
- alias :build :element
23
- end
24
-
25
- doc = XMLHelper.build do
26
- html do
27
- head do
28
- title "Test"
29
- end
30
- body do
31
- i "Hello"
32
- br
33
- text "Test"
34
- text "Hey"
35
- end
36
- end
37
- end
38
-
39
- doc.to_s
40
-
41
- _produces_
42
-
43
- <html><head><title>Test</title><body><i>Hello</i><br />TestHey</body></html>
44
-
45
- The Buildable module is based on BuildingBlock class. The same effect can be achieved using it directly:
46
-
47
- require 'facets'
48
- require 'xmlhelper'
49
-
50
- builder = BuildingBlock.new(XMLHelper, :element)
51
-
52
- doc = builder.html do
53
- head do
54
- title "Test"
55
- end
56
- body do
57
- i "Hello"
58
- br
59
- text "Test"
60
- text "Hey"
61
- end
62
- end
63
-
64
- doc.to_s
65
-
66
-
67
- == Installation
68
-
69
- IMPORTANT! This library is included in the complete facets package. You do not this library if you already have facets installed.
70
-
71
- You can install either via gem:
72
-
73
- gem install buildable
74
-
75
- or manually via tarball:
76
-
77
- wget http://rubyforge.org/frs/download.php/.../buildable-x.x.x.tgz
78
- cd buildable-x.x.x
79
- sudo util/setup
80
-
81
-
82
- == Documentation
83
-
84
- Please see doc/ directory for additional documentation.
85
-
86
-
87
- == Upcoming Features
88
-
89
- Better support for alternate output buffers.
90
-
91
-
92
- == Credit
93
-
94
- Trans
95
-
96
-
97
- == License
98
-
99
- Copyright (c) 2004-2007 Thomas Sawyer
100
-
101
- Distributed under the Ruby/GPL dual-license.
@@ -1,34 +0,0 @@
1
- = Facets Modeling
2
-
3
- Facets Modeling is a collection of libraries to assist in object-oriented
4
- modeling.
5
-
6
- == Libraries
7
-
8
- === Capsule
9
-
10
- A module which is an instance of the Capsule class encapsulates in its scope
11
- the top-level methods, top-level constants, and instance variables defined in
12
- a ruby script file (and its subfiles) loaded by a ruby program. This allows
13
- use of script files to define objects that can be loaded into a program in
14
- much the same way that objects can be loaded from YAML or Marshal files.
15
-
16
- See intro.txt[link:files/intro_txt.html] for an overview.
17
-
18
-
19
- == Contact
20
-
21
- facets-universal@rubyforge.org
22
-
23
-
24
- == Install
25
-
26
- gem install facets
27
-
28
-
29
- == License
30
-
31
- Facets
32
- Copyright (c) 2004 Thomas Sawyer
33
- Ruby License
34
-