methodchain 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +6 -8
- data/doc/created.rid +1 -1
- data/doc/fr_class_index.html +1 -2
- data/doc/fr_file_index.html +0 -3
- data/doc/fr_method_index.html +4 -3
- data/pkg/methodchain-0.0.5.gem +0 -0
- data/rakefile +22 -5
- metadata +3 -2
data/README
CHANGED
@@ -7,7 +7,7 @@ Copyright (c) 2008 Greg Weber, http://gregweber.info
|
|
7
7
|
Licensed under the MIT license
|
8
8
|
|
9
9
|
== Example
|
10
|
-
|
10
|
+
==== tap
|
11
11
|
if you don't already know about this method, look it up on the net. The tap included here allows message sending.
|
12
12
|
|
13
13
|
OLD WAY (still valid with this tap)
|
@@ -15,7 +15,7 @@ OLD WAY (still valid with this tap)
|
|
15
15
|
NEW WAY
|
16
16
|
[1].tap(:compact!).first # => 1
|
17
17
|
|
18
|
-
|
18
|
+
==== #then and #else
|
19
19
|
OLD WAY
|
20
20
|
name = person ? person.name : nil
|
21
21
|
|
@@ -58,16 +58,14 @@ Here we have removed one call to order and reduced the code to a one-liner. The
|
|
58
58
|
|
59
59
|
=== selectively import MethodChain methods
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
require 'methodchain/then_else'
|
61
|
+
require 'methodchain/not_included'
|
64
62
|
|
65
63
|
not_included will load the MethodChain module without including it anywhere.
|
66
|
-
|
67
|
-
require 'methodchain/not_included'
|
64
|
+
Already have your own version of tap? use the module-import gem to decide what to include
|
68
65
|
|
69
66
|
== Implementation
|
70
|
-
|
67
|
+
* There are no proxy objects, these are simply function calls, so it should be fast.
|
68
|
+
* A helper method called self_eval is also exposed. This method allows the two different block forms {|p| p.name} and {name}, where the second form is called using instance_eval.
|
71
69
|
|
72
70
|
== Install
|
73
71
|
gem install methodchain
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sun, 09 Mar 2008 12:16:13 -0500
|
data/doc/fr_class_index.html
CHANGED
@@ -20,8 +20,7 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Classes</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/MethodChain
|
24
|
-
<a href="classes/MethodChain/ThenElse.html">MethodChain::ThenElse</a><br />
|
23
|
+
<a href="classes/MethodChain.html">MethodChain</a><br />
|
25
24
|
</div>
|
26
25
|
</div>
|
27
26
|
</body>
|
data/doc/fr_file_index.html
CHANGED
@@ -22,10 +22,7 @@
|
|
22
22
|
<div id="index-entries">
|
23
23
|
<a href="files/README.html">README</a><br />
|
24
24
|
<a href="files/lib/methodchain_rb.html">lib/methodchain.rb</a><br />
|
25
|
-
<a href="files/lib/methodchain/import_rb.html">lib/methodchain/import.rb</a><br />
|
26
|
-
<a href="files/lib/methodchain/methodchain_rb.html">lib/methodchain/methodchain.rb</a><br />
|
27
25
|
<a href="files/lib/methodchain/not_included_rb.html">lib/methodchain/not_included.rb</a><br />
|
28
|
-
<a href="files/lib/methodchain/then_else_rb.html">lib/methodchain/then_else.rb</a><br />
|
29
26
|
</div>
|
30
27
|
</div>
|
31
28
|
</body>
|
data/doc/fr_method_index.html
CHANGED
@@ -20,9 +20,10 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/MethodChain
|
24
|
-
<a href="classes/MethodChain
|
25
|
-
<a href="classes/MethodChain
|
23
|
+
<a href="classes/MethodChain.html#M000003">else (MethodChain)</a><br />
|
24
|
+
<a href="classes/MethodChain.html#M000001">self_eval (MethodChain)</a><br />
|
25
|
+
<a href="classes/MethodChain.html#M000004">tap (MethodChain)</a><br />
|
26
|
+
<a href="classes/MethodChain.html#M000002">then (MethodChain)</a><br />
|
26
27
|
</div>
|
27
28
|
</div>
|
28
29
|
</body>
|
Binary file
|
data/rakefile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
project = "methodchain"
|
1
2
|
desc "test"
|
2
3
|
task :test do
|
3
4
|
Dir[ 'spec/*' ].each do |file|
|
4
5
|
puts `spec #{file}`
|
6
|
+
exit $?.exitstatus if $?.exitstatus != 0
|
5
7
|
end
|
6
8
|
end
|
7
9
|
|
@@ -10,7 +12,7 @@ task :release => [:rdoc,:package] do
|
|
10
12
|
Dir.chdir('pkg') do
|
11
13
|
release = Dir['*.gem'].sort_by {|file| File.mtime(file)}.last
|
12
14
|
release =~ /^[^-]+-([.0-9]+).gem$/
|
13
|
-
`rubyforge login && rubyforge add_release
|
15
|
+
`rubyforge login && rubyforge add_release #{project} #{project} #$1 #{release}`
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -19,16 +21,31 @@ task :rdoc do
|
|
19
21
|
fail unless system 'rdoc --force-update --quiet README lib/*'
|
20
22
|
end
|
21
23
|
|
24
|
+
namespace :readme do
|
25
|
+
desc "create html for website using coderay, use --silent option"
|
26
|
+
task :html => :rdoc do
|
27
|
+
require 'hpricot'
|
28
|
+
doc = open( 'doc/files/README.html' ) { |f| Hpricot(f) }
|
29
|
+
# find example code
|
30
|
+
doc.at('#description').search('pre').
|
31
|
+
select {|elem| elem.inner_html =~ /class |module /}.each do |ex|
|
32
|
+
# add coderay and undo what rdoc has done in the example code
|
33
|
+
ex.swap("<coderay lang='ruby'>#{ex.inner_html.gsub('"', '"').gsub('>','>')}</coderay>")
|
34
|
+
end
|
35
|
+
puts doc.at('#description').to_html
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
22
39
|
require 'rubygems'
|
23
40
|
require 'rake/gempackagetask'
|
24
41
|
|
25
42
|
spec = Gem::Specification.new do |s|
|
26
|
-
s.name =
|
27
|
-
s.rubyforge_project =
|
28
|
-
s.version = "0.0
|
43
|
+
s.name = project
|
44
|
+
s.rubyforge_project = project
|
45
|
+
s.version = "0.1.0"
|
29
46
|
s.author = "Greg Weber"
|
30
47
|
s.email = "greg@gregweber.info"
|
31
|
-
s.homepage = "http://projects.gregweber.info
|
48
|
+
s.homepage = "http://projects.gregweber.info/#{project}"
|
32
49
|
s.platform = Gem::Platform::RUBY
|
33
50
|
s.summary = "convenience methods for method chaining"
|
34
51
|
s.files = Dir['./**'] + Dir['*/**']
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: methodchain
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date: 2008-03-
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2008-03-09 00:00:00 -06:00
|
8
8
|
summary: convenience methods for method chaining
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/methodchain.rb
|
48
48
|
- pkg/methodchain-0.0.1.gem
|
49
49
|
- pkg/methodchain-0.0.3.gem
|
50
|
+
- pkg/methodchain-0.0.5.gem
|
50
51
|
- spec/not_included.rb
|
51
52
|
- spec/then_else.rb
|
52
53
|
- spec/methodchain_spec.rb
|