action_tree 0.1.1 → 0.2.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/.yardopts +3 -5
- data/README.md +6 -77
- data/Rakefile +16 -3
- data/TODO +84 -26
- data/VERSION +1 -1
- data/lib/action_tree.rb +46 -27
- data/lib/action_tree/basic.rb +36 -0
- data/lib/action_tree/basic/helpers.rb +20 -0
- data/lib/action_tree/basic/node.rb +294 -103
- data/lib/action_tree/basic/query.rb +211 -0
- data/lib/action_tree/basic/shared.rb +25 -0
- data/lib/action_tree/capture_hash.rb +28 -3
- data/lib/action_tree/components/rack.rb +52 -0
- data/lib/action_tree/components/rack/request.rb +59 -0
- data/lib/action_tree/components/rack/response.rb +10 -0
- data/lib/action_tree/components/tilt.rb +65 -0
- data/lib/action_tree/errors.rb +12 -0
- data/lib/action_tree/eval_scope.rb +18 -16
- data/spec/00_foundations/capture_hash_spec.rb +47 -0
- data/spec/00_foundations/eval_scope_spec.rb +80 -0
- data/spec/{02_node_spec.rb → 01_node/02_node_spec.rb} +8 -13
- data/spec/{03_match_spec.rb → 02_query/query_spec.rb} +5 -4
- data/spec/{04_integration_spec.rb → 03_action_tree_basic/04_integration_spec.rb} +10 -8
- data/spec/{p01_tilt_spec.rb → 04_components/template_spec.rb} +5 -9
- metadata +66 -20
- data/MANUAL.md +0 -277
- data/lib/action_tree/basic/match.rb +0 -132
- data/lib/action_tree/dialect_helper.rb +0 -12
- data/lib/action_tree/plugins/tilt.rb +0 -65
- data/spec/01_support_lib_spec.rb +0 -41
data/spec/01_support_lib_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'action_tree'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
describe ActionTree::EvalScope do
|
7
|
-
it 'has access to local variables' do
|
8
|
-
@say = 'tra la la a ring a ding ding'
|
9
|
-
ActionTree::EvalScope.new(self).instance_eval do
|
10
|
-
@say
|
11
|
-
end.should == 'tra la la a ring a ding ding'
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'extends modules' do
|
15
|
-
module Hooga
|
16
|
-
def words_of_wisdom
|
17
|
-
'touch my tra la la my ding ding dong'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
ActionTree::EvalScope.new(Hooga).words_of_wisdom.should ==
|
21
|
-
'touch my tra la la my ding ding dong'
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'overwrites sooner with later extensions' do
|
25
|
-
prepare = Proc.new { @greeting = 'Hello' }
|
26
|
-
greet = Proc.new { "#{@greeting} #{get_name}" }
|
27
|
-
module Booga
|
28
|
-
def get_name
|
29
|
-
'Melchior'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
module Shooga
|
33
|
-
def get_name
|
34
|
-
'Baltazar'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
scope = ActionTree::EvalScope.new(Booga, Shooga, self)
|
38
|
-
scope.instance_eval(&prepare)
|
39
|
-
scope.instance_eval(&greet).should == 'Hello Baltazar'
|
40
|
-
end
|
41
|
-
end
|