snidely_whiplash 1.0.0 → 1.0.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/lib/snidely_whiplash/version.rb +1 -1
- data/lib/snidely_whiplash.rb +6 -2
- data/spec/snidely_whiplash_spec.rb +7 -0
- metadata +1 -1
data/lib/snidely_whiplash.rb
CHANGED
@@ -10,8 +10,12 @@ class SnidelyWhiplash
|
|
10
10
|
"{{#{@path || ''}}}"
|
11
11
|
end
|
12
12
|
|
13
|
-
def method_missing(
|
14
|
-
SnidelyWhiplash.new(@path.nil? ?
|
13
|
+
def method_missing(method_sym, *args, &block)
|
14
|
+
SnidelyWhiplash.new(@path.nil? ? method_sym.to_s : "#{@path}.#{method_sym.to_s}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def respond_to?(method_sym, include_private=false)
|
18
|
+
Object.new.respond_to? method_sym, include_private
|
15
19
|
end
|
16
20
|
|
17
21
|
end
|
@@ -19,4 +19,11 @@ describe SnidelyWhiplash do
|
|
19
19
|
obj.example.to_s.should eql '{{parent.example}}'
|
20
20
|
obj.nested.example.to_s.should eql '{{parent.nested.example}}'
|
21
21
|
end
|
22
|
+
|
23
|
+
# This particular example comes from a problem I ran into with haml
|
24
|
+
it "should not try to convert to an array" do
|
25
|
+
obj = SnidelyWhiplash.new
|
26
|
+
ary = [obj]
|
27
|
+
ary.flatten.should eql [obj]
|
28
|
+
end
|
22
29
|
end
|