action_tree 0.1.0 → 0.1.1
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/VERSION +1 -1
- data/lib/action_tree/basic/node.rb +2 -15
- data/spec/02_node_spec.rb +4 -0
- data/spec/03_match_spec.rb +6 -1
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.1
|
|
@@ -25,24 +25,11 @@ class ActionTree::Basic::Node
|
|
|
25
25
|
# INSPECTION
|
|
26
26
|
|
|
27
27
|
def inspect
|
|
28
|
-
"#<#{self.class}:#{self.object_id.to_s(16)} #{
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def display_name
|
|
32
|
-
case @token
|
|
33
|
-
when String then @token
|
|
34
|
-
when Symbol then @token.inspect
|
|
35
|
-
when Regexp then @token.source
|
|
36
|
-
when nil then '(nil)'
|
|
37
|
-
end + ' ' + [
|
|
38
|
-
@actions.size.to_s,
|
|
39
|
-
@before_hooks.size,
|
|
40
|
-
@after_hooks.size
|
|
41
|
-
].join(', ')
|
|
28
|
+
"#<#{self.class}:#{self.object_id.to_s(16)} #{@token.inspect} >"
|
|
42
29
|
end
|
|
43
30
|
|
|
44
31
|
def printout(stack='')
|
|
45
|
-
stack +
|
|
32
|
+
stack + @token.inspect + "\n" +
|
|
46
33
|
@children.map {|c| c.printout(stack + ' ') }.join
|
|
47
34
|
end
|
|
48
35
|
|
data/spec/02_node_spec.rb
CHANGED
data/spec/03_match_spec.rb
CHANGED
|
@@ -7,6 +7,11 @@ require 'action_tree'
|
|
|
7
7
|
|
|
8
8
|
describe ActionTree::Basic::Match do
|
|
9
9
|
|
|
10
|
+
it 'can be inspected' do
|
|
11
|
+
ActionTree.new.match.inspect
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
|
|
10
15
|
describe 'captures' do
|
|
11
16
|
|
|
12
17
|
subject do
|
|
@@ -28,7 +33,7 @@ describe ActionTree::Basic::Match do
|
|
|
28
33
|
subject.match('/Homo').run.should == 'Homo'
|
|
29
34
|
end
|
|
30
35
|
|
|
31
|
-
it 'values
|
|
36
|
+
it 'three values' do
|
|
32
37
|
subject.match('/Homo/Sapiens-Sapiens').run.should ==
|
|
33
38
|
'Homo Sapiens Sapiens'
|
|
34
39
|
end
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 1
|
|
8
|
-
-
|
|
9
|
-
version: 0.1.
|
|
8
|
+
- 1
|
|
9
|
+
version: 0.1.1
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- jbe
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2011-
|
|
17
|
+
date: 2011-02-02 00:00:00 +01:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|