hotcell 0.2.0 → 0.3.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.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyromaniac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-06 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: racc
@@ -77,7 +77,6 @@ files:
77
77
  - lib/hotcell/lexer.rl
78
78
  - lib/hotcell/lexerr.rb
79
79
  - lib/hotcell/lexerr.rl
80
- - lib/hotcell/manipulator.rb
81
80
  - lib/hotcell/node.rb
82
81
  - lib/hotcell/node/arrayer.rb
83
82
  - lib/hotcell/node/assigner.rb
@@ -95,9 +94,10 @@ files:
95
94
  - lib/hotcell/scope.rb
96
95
  - lib/hotcell/source.rb
97
96
  - lib/hotcell/template.rb
97
+ - lib/hotcell/tong.rb
98
98
  - lib/hotcell/version.rb
99
99
  - spec/data/dstrings
100
- - spec/data/sstrings
100
+ - spec/data/strings
101
101
  - spec/data/templates/simple.hc
102
102
  - spec/lib/hotcell/commands/case_spec.rb
103
103
  - spec/lib/hotcell/commands/cycle_spec.rb
@@ -109,7 +109,6 @@ files:
109
109
  - spec/lib/hotcell/config_spec.rb
110
110
  - spec/lib/hotcell/context_spec.rb
111
111
  - spec/lib/hotcell/lexer_spec.rb
112
- - spec/lib/hotcell/manipulator_spec.rb
113
112
  - spec/lib/hotcell/node/block_spec.rb
114
113
  - spec/lib/hotcell/node/command_spec.rb
115
114
  - spec/lib/hotcell/node/tag_spec.rb
@@ -118,6 +117,7 @@ files:
118
117
  - spec/lib/hotcell/scope_spec.rb
119
118
  - spec/lib/hotcell/source_spec.rb
120
119
  - spec/lib/hotcell/template_spec.rb
120
+ - spec/lib/hotcell/tong_spec.rb
121
121
  - spec/lib/hotcell_spec.rb
122
122
  - spec/spec_helper.rb
123
123
  homepage: ''
@@ -139,13 +139,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
- rubygems_version: 2.0.3
142
+ rubygems_version: 2.0.5
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Sandboxed ruby template processor
146
146
  test_files:
147
147
  - spec/data/dstrings
148
- - spec/data/sstrings
148
+ - spec/data/strings
149
149
  - spec/data/templates/simple.hc
150
150
  - spec/lib/hotcell/commands/case_spec.rb
151
151
  - spec/lib/hotcell/commands/cycle_spec.rb
@@ -157,7 +157,6 @@ test_files:
157
157
  - spec/lib/hotcell/config_spec.rb
158
158
  - spec/lib/hotcell/context_spec.rb
159
159
  - spec/lib/hotcell/lexer_spec.rb
160
- - spec/lib/hotcell/manipulator_spec.rb
161
160
  - spec/lib/hotcell/node/block_spec.rb
162
161
  - spec/lib/hotcell/node/command_spec.rb
163
162
  - spec/lib/hotcell/node/tag_spec.rb
@@ -166,5 +165,6 @@ test_files:
166
165
  - spec/lib/hotcell/scope_spec.rb
167
166
  - spec/lib/hotcell/source_spec.rb
168
167
  - spec/lib/hotcell/template_spec.rb
168
+ - spec/lib/hotcell/tong_spec.rb
169
169
  - spec/lib/hotcell_spec.rb
170
170
  - spec/spec_helper.rb
@@ -1,49 +0,0 @@
1
- module Hotcell
2
- class Manipulator
3
- module Mixin
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- class_attribute :manipulator_methods, instance_writter: false
8
- self.manipulator_methods = Set.new
9
-
10
- def self.manipulate *methods
11
- self.manipulator_methods = Set.new(manipulator_methods.to_a + methods.flatten.map(&:to_s))
12
- end
13
- end
14
-
15
- def to_manipulator
16
- self
17
- end
18
-
19
- def manipulator_invoke method, *arguments
20
- if method == '[]'
21
- manipulator_invoke_brackets *arguments
22
- elsif manipulator_invokable? method
23
- send(method, *arguments)
24
- end
25
- end
26
-
27
- private
28
-
29
- def manipulator_invokable? method
30
- manipulator_methods.include? method
31
- end
32
-
33
- def manipulator_invoke_brackets *arguments
34
- if respond_to? :[]
35
- self[*arguments]
36
- else
37
- manipulator_invoke *arguments
38
- end
39
- end
40
- end
41
-
42
- include Mixin
43
-
44
- def manipulator_methods
45
- @manipulator_methods ||= Set.new((self.class.public_instance_methods -
46
- Hotcell::Manipulator.public_instance_methods).map(&:to_s))
47
- end
48
- end
49
- end
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hotcell::Manipulator do
4
- context 'mixed in' do
5
- context do
6
- let(:klass) do
7
- Class.new(Numeric) do
8
- include Hotcell::Manipulator::Mixin
9
-
10
- def foo; end
11
- end
12
- end
13
- subject { klass.new }
14
-
15
- its(:manipulator_methods) { should be_a Set }
16
- its(:manipulator_methods) { should be_empty }
17
- its(:to_manipulator) { should === subject }
18
- specify { subject.manipulator_invoke('foo').should be_nil }
19
- specify { subject.manipulator_invoke(:foo).should be_nil }
20
- specify { subject.manipulator_invoke('foo', 42, :arg).should be_nil }
21
- end
22
-
23
- context do
24
- let(:klass) do
25
- Class.new(String) do
26
- include Hotcell::Manipulator::Mixin
27
-
28
- manipulate :foo, :bar
29
-
30
- alias_method :foo, :split
31
- alias_method :bar, :size
32
- end
33
- end
34
- subject { klass.new('hello world') }
35
-
36
- its(:to_manipulator) { should === subject }
37
- specify { (subject.manipulator_methods.to_a & %w(foo bar)).should =~ %w(foo bar) }
38
- specify { subject.manipulator_invoke('baz').should be_nil }
39
- specify { subject.manipulator_invoke('baz', 42, :arg).should be_nil }
40
- specify { subject.manipulator_invoke(:foo).should be_nil }
41
- specify { subject.manipulator_invoke('foo').should == %w(hello world) }
42
- specify { subject.manipulator_invoke('bar').should == 11 }
43
- specify { expect { subject.manipulator_invoke('bar', 42) }.to raise_error ArgumentError }
44
- end
45
- end
46
-
47
- context 'inherited' do
48
- let(:klass) do
49
- Class.new(described_class) do
50
- def foo
51
- 'foo'
52
- end
53
-
54
- def bar arg1, arg2
55
- arg1 + arg2
56
- end
57
- end
58
- end
59
- subject { klass.new }
60
-
61
- its('manipulator_methods.to_a') { should =~ %w(foo bar) }
62
- its(:to_manipulator) { should === subject }
63
- specify { subject.manipulator_invoke('send').should be_nil }
64
- specify { subject.manipulator_invoke(:bar).should be_nil }
65
- specify { subject.manipulator_invoke('foo').should == 'foo' }
66
- specify { subject.manipulator_invoke('bar', 5, 8).should == 13 }
67
- specify { expect { subject.manipulator_invoke('bar') }.to raise_error ArgumentError }
68
- end
69
- end