hobosupport 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest ADDED
@@ -0,0 +1,25 @@
1
+ CHANGES.txt
2
+ lib/hobosupport/array.rb
3
+ lib/hobosupport/blankslate.rb
4
+ lib/hobosupport/enumerable.rb
5
+ lib/hobosupport/fixes/chronic.rb
6
+ lib/hobosupport/fixes/module.rb
7
+ lib/hobosupport/fixes/pp.rb
8
+ lib/hobosupport/fixes.rb
9
+ lib/hobosupport/hash.rb
10
+ lib/hobosupport/implies.rb
11
+ lib/hobosupport/metaid.rb
12
+ lib/hobosupport/methodcall.rb
13
+ lib/hobosupport/methodphitamine.rb
14
+ lib/hobosupport/module.rb
15
+ lib/hobosupport.rb
16
+ Manifest.txt
17
+ README.txt
18
+ test/hobosupport/enumerable.rdoctest
19
+ test/hobosupport/hash.rdoctest
20
+ test/hobosupport/implies.rdoctest
21
+ test/hobosupport/metaid.rdoctest
22
+ test/hobosupport/methodphitamine.rdoctest
23
+ test/hobosupport/module.rdoctest
24
+ test/hobosupport.rdoctest
25
+ Manifest
@@ -0,0 +1,41 @@
1
+
2
+ # Gem::Specification for Hobosupport-0.7.5
3
+ # Originally generated by Echoe
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{hobosupport}
7
+ s.version = "0.7.5"
8
+
9
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Tom Locke"]
13
+ s.date = %q{2008-04-18}
14
+ s.description = %q{Core Ruby extensions from the Hobo project}
15
+ s.email = %q{tom@tomlocke.com}
16
+ s.extra_rdoc_files = ["lib/hobosupport/array.rb", "lib/hobosupport/blankslate.rb", "lib/hobosupport/enumerable.rb", "lib/hobosupport/fixes/chronic.rb", "lib/hobosupport/fixes/module.rb", "lib/hobosupport/fixes/pp.rb", "lib/hobosupport/fixes.rb", "lib/hobosupport/hash.rb", "lib/hobosupport/implies.rb", "lib/hobosupport/metaid.rb", "lib/hobosupport/methodcall.rb", "lib/hobosupport/methodphitamine.rb", "lib/hobosupport/module.rb", "lib/hobosupport.rb", "README.txt"]
17
+ s.files = ["CHANGES.txt", "lib/hobosupport/array.rb", "lib/hobosupport/blankslate.rb", "lib/hobosupport/enumerable.rb", "lib/hobosupport/fixes/chronic.rb", "lib/hobosupport/fixes/module.rb", "lib/hobosupport/fixes/pp.rb", "lib/hobosupport/fixes.rb", "lib/hobosupport/hash.rb", "lib/hobosupport/implies.rb", "lib/hobosupport/metaid.rb", "lib/hobosupport/methodcall.rb", "lib/hobosupport/methodphitamine.rb", "lib/hobosupport/module.rb", "lib/hobosupport.rb", "Manifest.txt", "README.txt", "test/hobosupport/enumerable.rdoctest", "test/hobosupport/hash.rdoctest", "test/hobosupport/implies.rdoctest", "test/hobosupport/metaid.rdoctest", "test/hobosupport/methodphitamine.rdoctest", "test/hobosupport/module.rdoctest", "test/hobosupport.rdoctest", "Manifest", "hobosupport.gemspec"]
18
+ s.has_rdoc = true
19
+ s.homepage = %q{http://hobocentral.net/hobosupport}
20
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Hobosupport", "--main", "README.txt"]
21
+ s.require_paths = ["lib"]
22
+ s.rubyforge_project = %q{hobo}
23
+ s.rubygems_version = %q{1.0.1}
24
+ s.summary = %q{Core Ruby extensions from the Hobo project}
25
+ end
26
+
27
+
28
+ # # Original Rakefile source (requires the Echoe gem):
29
+ #
30
+ # require 'echoe'
31
+ #
32
+ # Echoe.new('hobosupport') do |p|
33
+ # p.author = "Tom Locke"
34
+ # p.email = "tom@tomlocke.com"
35
+ # p.summary = "Core Ruby extensions from the Hobo project"
36
+ # p.url = "http://hobocentral.net/hobosupport"
37
+ # p.project = "hobo"
38
+ #
39
+ # p.changelog = "CHANGES.txt"
40
+ # p.version = "0.7.5"
41
+ # end
data/lib/hobosupport.rb CHANGED
@@ -13,7 +13,7 @@ require 'hobosupport/module'
13
13
 
14
14
  module HoboSupport
15
15
 
16
- VERSION = "0.7.4"
16
+ VERSION = "0.7.5"
17
17
 
18
18
  end
19
19
 
@@ -4,7 +4,7 @@
4
4
  >> HoboSupport::VERSION
5
5
  => "0.1"
6
6
 
7
- ## Enumerable#search
7
+ ## `Enumerable#search`
8
8
 
9
9
  * `enum.search(not_found) { |element| block}`
10
10
 
@@ -15,7 +15,7 @@ E.g. The length of the first word that starts with a capital letter
15
15
  >> %w(my name is Fred).search { |s| s.length if s =~ /^[A-Z]/ }
16
16
  => 4
17
17
 
18
- ## Enumerable#map_with_index
18
+ ## `Enumerable#map_with_index`
19
19
 
20
20
  * `enum.map_with_index { |element, index| block }`
21
21
 
@@ -24,7 +24,7 @@ Just like #map but the block gets the element and the index.
24
24
  >> %w(some short words).map_with_index { |s, i| s * i }
25
25
  => ["", "short", "wordswords"]
26
26
 
27
- ## Enumerable#build_hash
27
+ ## `Enumerable#build_hash`
28
28
 
29
29
  * `enum.build_hash { |element| block }`
30
30
 
@@ -34,7 +34,7 @@ The block is passed each element in turn and should return a key/value pair. If
34
34
  => {"some"=>4, "words"=>5}
35
35
 
36
36
 
37
- ## Enumerable#map_hash
37
+ ## `Enumerable#map_hash`
38
38
 
39
39
  * `enum.map_hash { |element| block }`
40
40
 
@@ -43,7 +43,7 @@ Each element is passed to the block. Returns a hash where the keys are the eleme
43
43
  >> %w(some short words).map_hash { |s| s.length }
44
44
  => {"some"=>4, "short"=>5, "words"=>5}
45
45
 
46
- ## Enumerable#rest
46
+ ## `Enumerable#rest`
47
47
 
48
48
  Shorthand for `enum[1..-1]`
49
49
 
@@ -51,28 +51,28 @@ Shorthand for `enum[1..-1]`
51
51
  => ["short", "words"]
52
52
 
53
53
 
54
- ## Enumerable#*
54
+ ## `Enumerable#*`
55
55
 
56
56
  Shorthand for `map` when you need to map a single method call on the elements.
57
57
 
58
58
  >> %w(some short words).*.length
59
59
  => [4, 5, 5]
60
60
 
61
- ## Enumerable#where
61
+ ## `Enumerable#where`
62
62
 
63
63
  Shorthand for `select` when you need to select on a single method call.
64
64
 
65
65
  >> %w(some short words).where.include?("r")
66
66
  => ["short", "words"]
67
67
 
68
- ## Enumerable#where_not
68
+ ## `Enumerable#where_not`
69
69
 
70
70
  Shorthand for `reject` when you need to reject on a single method call.
71
71
 
72
72
  >> %w(some short words).where_not.include?("r")
73
73
  => ["some"]
74
74
 
75
- ## Enumerable#drop_while
75
+ ## `Enumerable#drop_while`
76
76
 
77
77
  * `enum.drop_while { |element| block }`
78
78
 
@@ -89,7 +89,7 @@ There is also a destructive version for arrays
89
89
  => ["a", "nice", "example"]
90
90
 
91
91
 
92
- ## Enumerable#take_while
92
+ ## `Enumerable#take_while`
93
93
 
94
94
  * `enum.take_while { |element| block }`
95
95
 
@@ -99,7 +99,7 @@ Passes each element in turn to the block until the block returns false. Returns
99
99
  => ["this", "is"]
100
100
 
101
101
 
102
- ## Object#in?
102
+ ## `Object#in?`
103
103
 
104
104
  * `obj.in?(enum)`
105
105
 
@@ -115,7 +115,7 @@ Shorthand for `enum.include?(obj)`
115
115
  >> 3.in?(nil)
116
116
  => false
117
117
 
118
- ## Object#not_in?
118
+ ## `Object#not_in?`
119
119
 
120
120
  * `obj.not_in?(enum)`
121
121
 
@@ -4,7 +4,7 @@
4
4
  >> HoboSupport::VERSION
5
5
  => "0.1"
6
6
 
7
- ## Hash#select_hash
7
+ ## `Hash#select_hash`
8
8
 
9
9
  * `hash.select_hash { |key, value| block } => hash`
10
10
  * `hash.select_hash { |value| block } => hash`
@@ -20,7 +20,7 @@ You can also give a block that takes one argument, in which case the block is gi
20
20
  => {3=>4, 6=>5}
21
21
 
22
22
 
23
- ## Hash#map_hash
23
+ ## `Hash#map_hash`
24
24
 
25
25
  * `hash.map_hash { |key, value| block } => hash`
26
26
  * `hash.map_hash { |value| block } => hash`
@@ -36,7 +36,7 @@ You can also give a block which takes one argument, in which case only the value
36
36
  => {1=>200, 3=>400, 6=>500 }
37
37
 
38
38
 
39
- ## Hash#partition_hash
39
+ ## `Hash#partition_hash`
40
40
 
41
41
  * `hash.partition_hash(keys) => [hash1, hash2]`
42
42
  * `hash.partition_hash { |key, value| block } => hash`
@@ -51,7 +51,7 @@ When passed a block, each pair is passed to the block in turn. The result is two
51
51
  >> {1=>2, 3=>4, 6=>5}.partition_hash { |key, value| key < value }
52
52
  => [{1=>2, 3=>4}, {6=>5}]
53
53
 
54
- ## Hash.recursive_update
54
+ ## `Hash.recursive_update`
55
55
 
56
56
  * `hash.recursive_update(hash2)`
57
57
 
@@ -63,7 +63,7 @@ Like `#update` but where a sub-hash would overwrite another sub-hash, they are i
63
63
  => { :a => 1, :b => { :x => 10, :y => 20}, :c => 3 }
64
64
 
65
65
 
66
- ## Hash#-
66
+ ## `Hash#-`
67
67
 
68
68
  * `hash - array => hash`
69
69
 
@@ -72,7 +72,7 @@ Returns a new hash, the left-hand-side hash with all pairs removed where the key
72
72
  >> {1=>2, 3=>4, 6=>5} - [1, 3]
73
73
  => {6 => 5}
74
74
 
75
- ## Hash#&
75
+ ## `Hash#&`
76
76
 
77
77
  * `hash & array => array`
78
78
 
@@ -81,7 +81,7 @@ Returns a new array, the left hand side hash restricted to pairs where the key i
81
81
  >> {1=>2, 3=>4, 6=>5} & [1, 3]
82
82
  => {1=>2, 3=>4}
83
83
 
84
- ## Hash#|
84
+ ## `Hash#|`
85
85
 
86
86
  * `hash | hash => hash`
87
87
 
@@ -91,7 +91,7 @@ An alias for merge
91
91
  => {1 => 3, 2 => 4}
92
92
 
93
93
 
94
- ## Hash#get
94
+ ## `Hash#get`
95
95
 
96
96
  * `hash.get(*args) => hash`
97
97
 
@@ -100,7 +100,7 @@ Returns an array of values for the given keys. Useful for extracting a few optio
100
100
  >> {1=>2, 3=>4, 6=>5}.get(1, 3)
101
101
  => [2, 4]
102
102
 
103
- ## Hash#compact
103
+ ## `Hash#compact`
104
104
 
105
105
  * `hash.compact => hash`
106
106
 
@@ -109,7 +109,7 @@ Returns a hash with the same items as the receiver except those where the value
109
109
  >> {1=>'a', 2=>nil, 3=>'b'}.compact
110
110
  => {1=>'a', 3=>'b'}
111
111
 
112
- ## Hash#compact
112
+ ## `Hash#compact`
113
113
 
114
114
  * `hash.compact!`
115
115
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  The implies operator comes from Eiffel. Often comes in handy in Hobo's model-permission methods.
8
8
 
9
- ## TrueClass#implies and FalseClass#implies
9
+ ## `TrueClass#implies` and `FalseClass#implies`
10
10
 
11
11
  >> false.implies true
12
12
  => true
@@ -6,7 +6,7 @@
6
6
 
7
7
  Why the Luck Stiff's essential meta-programming additions to Object. These are probably distributed elsewhere, but they're small enough to throw them in to HoboSupport and remove an external dependency.
8
8
 
9
- ## Object#metaclass
9
+ ## `Object#metaclass`
10
10
 
11
11
  Returns the "metaclass" (bad name) or "singleton class" of a given ruby Object
12
12
 
@@ -17,7 +17,7 @@ Returns the "metaclass" (bad name) or "singleton class" of a given ruby Object
17
17
  >> o.metaclass.instance_methods.grep "foo"
18
18
  => ["foo"]
19
19
 
20
- ## Object#meta_eval
20
+ ## `Object#meta_eval`
21
21
 
22
22
  * `object.meta_eval(string)`
23
23
  * `object.meta_eval { block }`
@@ -34,12 +34,12 @@ And with a block
34
34
  >> File.b2 "a/b"
35
35
  => "b"
36
36
 
37
- ## Object#metaclass_eval
37
+ ## `Object#metaclass_eval`
38
38
 
39
39
  * `object.metaclass_eval(string)`
40
40
  * `object.metaclass_eval { block }`
41
41
 
42
- Like #meta_eval, but does a `class_eval` instead of an `instance_eval`
42
+ Like `#meta_eval`, but does a `class_eval` instead of an `instance_eval`
43
43
 
44
44
  >> File.metaclass_eval "def b3(path); basename(path); end"
45
45
  >> File.b3 "a/b"
@@ -52,7 +52,7 @@ And with a block
52
52
  => "b"
53
53
 
54
54
 
55
- ## Object#meta_def
55
+ ## `Object#meta_def`
56
56
 
57
57
  >> String.meta_def(:backwards_new) { |s| s.reverse }
58
58
  >> String.backwards_new "strange"
@@ -4,7 +4,7 @@
4
4
  >> HoboSupport::VERSION
5
5
  => "0.1"
6
6
 
7
- ## Kernel#it and Kernel#its
7
+ ## `Kernel#it` and `Kernel#its`
8
8
 
9
9
  A nice hack from Jay Phillips, christened "Methodphitamine". The low-down is in the [original blog post][1].
10
10
 
@@ -4,7 +4,7 @@
4
4
  >> HoboSupport::VERSION
5
5
  => "0.1"
6
6
 
7
- ## Module#included_in_class_callbacks
7
+ ## `Module#included_in_class_callbacks`
8
8
 
9
9
  Bit involved, this one :-)
10
10
 
@@ -42,7 +42,7 @@ When a module is included in a class, it gets a callback on the `included` metho
42
42
  => "MY NAME IS C"
43
43
 
44
44
 
45
- ## Module#interiting_cattr_reader
45
+ ## `Module#interiting_cattr_reader`
46
46
 
47
47
  Declares a reader for an instance variable on the class. The attribute is looked up on the superclass if not defined on the receiving class. In other words, the superclass defines a default that subclasses can override. The declaration can also give a default, as shown here.
48
48
 
@@ -69,7 +69,7 @@ Now we change the nickname of `B`. `A` retains it's existing nickname.
69
69
  => "Andy"
70
70
 
71
71
 
72
- ## Kernel#classy_module
72
+ ## `Kernel#classy_module`
73
73
 
74
74
  In Ruby we use modules to factor out features that are shared by more than one class. By including the module, a class gets the module's features, just as if they were defined inside the class. This mechanism is very simple if the shared features are all instance methods, but starts to get complicated when we want to share class-level features. For example, to create a module that adds class-methods to the including class, Ruby programmers often use the ClassMethods sub-module idiom:
75
75
 
@@ -8,9 +8,18 @@ HoboSupport is a mixed bag of core ruby extensions that have been extracted from
8
8
  >> HoboSupport::VERSION
9
9
  => "0.1"
10
10
 
11
+ ## Contents
12
+
13
+ * [Enumerable](/hobosupport/hobosupport/enumerable/)
14
+ * [Hash](/hobosupport/hobosupport/hash/)
15
+ * [Implies](/hobosupport/hobosupport/implies/)
16
+ * [Metaid](/hobosupport/hobosupport/metaid/)
17
+ * [Methodphitamine](/hobosupport/hobosupport/methodphitamine)
18
+ * [Module](/hobosupport/hobosupport/module)
19
+
11
20
  ## Object extensions
12
21
 
13
- ### Object#is_a?
22
+ ### `Object#is_a?`
14
23
 
15
24
  Extended to allow multiple types to be checked in one go
16
25
 
@@ -31,7 +40,7 @@ Still works the old way
31
40
 
32
41
  ## Method call extensions
33
42
 
34
- ### Object#_?
43
+ ### `Object#_?`
35
44
 
36
45
  We have the "." operator to call methods on objects. These extensions introduce two "special dots". "`._?.`" only calls the method if the receiver is not `nil`.
37
46
 
@@ -41,7 +50,7 @@ We have the "." operator to call methods on objects. These extensions introduce
41
50
  => nil
42
51
 
43
52
 
44
- ### Object#try
53
+ ### `Object#try`
45
54
 
46
55
  "`.try`" only calls the method if the receiver responds to that method.
47
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobosupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Locke
@@ -9,58 +9,67 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-07 00:00:00 +01:00
12
+ date: 2008-04-18 00:00:00 +01:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.5.1
23
- version:
24
- description: "== DESCRIPTION: A mixed bag of core Ruby extenstion that have been extracted from the Hobo project. == INSTALL: * sudo gem install hobosupport"
14
+ dependencies: []
15
+
16
+ description: Core Ruby extensions from the Hobo project
25
17
  email: tom@tomlocke.com
26
18
  executables: []
27
19
 
28
20
  extensions: []
29
21
 
30
22
  extra_rdoc_files:
31
- - History.txt
32
- - Manifest.txt
23
+ - lib/hobosupport/array.rb
24
+ - lib/hobosupport/blankslate.rb
25
+ - lib/hobosupport/enumerable.rb
26
+ - lib/hobosupport/fixes/chronic.rb
27
+ - lib/hobosupport/fixes/module.rb
28
+ - lib/hobosupport/fixes/pp.rb
29
+ - lib/hobosupport/fixes.rb
30
+ - lib/hobosupport/hash.rb
31
+ - lib/hobosupport/implies.rb
32
+ - lib/hobosupport/metaid.rb
33
+ - lib/hobosupport/methodcall.rb
34
+ - lib/hobosupport/methodphitamine.rb
35
+ - lib/hobosupport/module.rb
36
+ - lib/hobosupport.rb
33
37
  - README.txt
34
38
  files:
35
- - History.txt
36
- - Manifest.txt
37
- - README.txt
38
- - Rakefile
39
- - lib/hobosupport.rb
39
+ - CHANGES.txt
40
40
  - lib/hobosupport/array.rb
41
41
  - lib/hobosupport/blankslate.rb
42
42
  - lib/hobosupport/enumerable.rb
43
- - lib/hobosupport/fixes.rb
44
43
  - lib/hobosupport/fixes/chronic.rb
45
44
  - lib/hobosupport/fixes/module.rb
46
45
  - lib/hobosupport/fixes/pp.rb
46
+ - lib/hobosupport/fixes.rb
47
47
  - lib/hobosupport/hash.rb
48
48
  - lib/hobosupport/implies.rb
49
49
  - lib/hobosupport/metaid.rb
50
50
  - lib/hobosupport/methodcall.rb
51
51
  - lib/hobosupport/methodphitamine.rb
52
52
  - lib/hobosupport/module.rb
53
- - test/hobosupport.rdoctest
53
+ - lib/hobosupport.rb
54
+ - Manifest.txt
55
+ - README.txt
54
56
  - test/hobosupport/enumerable.rdoctest
55
57
  - test/hobosupport/hash.rdoctest
56
58
  - test/hobosupport/implies.rdoctest
57
59
  - test/hobosupport/metaid.rdoctest
58
60
  - test/hobosupport/methodphitamine.rdoctest
59
61
  - test/hobosupport/module.rdoctest
62
+ - test/hobosupport.rdoctest
63
+ - Manifest
64
+ - hobosupport.gemspec
60
65
  has_rdoc: true
61
- homepage: http://hobocentral.net/hobo-support
66
+ homepage: http://hobocentral.net/hobosupport
62
67
  post_install_message:
63
68
  rdoc_options:
69
+ - --line-numbers
70
+ - --inline-source
71
+ - --title
72
+ - Hobosupport
64
73
  - --main
65
74
  - README.txt
66
75
  require_paths:
data/Rakefile DELETED
@@ -1,17 +0,0 @@
1
- require 'rubygems'
2
- require 'hoe'
3
-
4
- $: << "./lib"
5
-
6
- require 'hobosupport'
7
-
8
- Hoe.new('hobosupport', HoboSupport::VERSION) do |p|
9
- p.rubyforge_name = 'hobo'
10
- p.author = 'Tom Locke'
11
- p.email = 'tom@tomlocke.com'
12
- p.url = "http://hobocentral.net/hobo-support"
13
- p.summary = 'Core Ruby extensions from the Hobo project'
14
- p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
15
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
16
- end
17
-
File without changes