delorean_lang 0.1.00 → 0.1.01

Sign up to get free protection for your applications and to get access to all the features.
data/lib/delorean/base.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'active_support/time'
2
+
1
3
  module Delorean
2
4
 
3
5
  # FIXME: the whitelist is quite hacky. It's currently difficult to
@@ -94,7 +96,7 @@ module Delorean
94
96
  raise InvalidIndex unless args.length == 1
95
97
  _get_attr(obj, args[0], _e)
96
98
  elsif obj.instance_of?(Array)
97
- raise InvalidIndex unless args.length < 2
99
+ raise InvalidIndex unless args.length <= 2
98
100
  raise InvalidIndex unless
99
101
  args[0].is_a?(Fixnum) && (!args[1] || args[1].is_a?(Fixnum))
100
102
  obj[*args]
@@ -132,7 +134,7 @@ module Delorean
132
134
  raise "no such method #{method}" unless sig
133
135
 
134
136
  # if sig is a string, then method mapped to another name
135
- return _instance_call(obj, sig, args) if sig.respond_to?(:to_sym)
137
+ return _instance_call(obj, sig, args) if sig.is_a? String
136
138
 
137
139
  raise "too many args to #{method}" if args.length>(sig.length-1)
138
140
 
@@ -296,10 +296,8 @@ module Delorean
296
296
  def enumerate_attrs_by_node(node)
297
297
  raise "bad node" unless node
298
298
 
299
- # FIXME: for some reason, in rspec we get nodes which are String
300
- # but .is_a?(String) fails.
301
299
  begin
302
- klass = node.class.name=="String" ? @m.module_eval(node) : node
300
+ klass = node.is_a?(String) ? @m.module_eval(node) : node
303
301
  rescue NameError
304
302
  # FIXME: a little hacky. Should raise an exception.
305
303
  return []
@@ -1,3 +1,3 @@
1
1
  module Delorean
2
- VERSION = "0.1.00"
2
+ VERSION = "0.1.01"
3
3
  end
data/spec/eval_spec.rb CHANGED
@@ -723,9 +723,10 @@ eof
723
723
  " c = a[-1]",
724
724
  " d = {'a' : 123, 'b': 456}",
725
725
  " e = d['b']",
726
+ " f = a[1,2]",
726
727
  )
727
- r = engine.evaluate_attrs("A", ["b", "c", "e"])
728
- r.should == [2, 3, 456]
728
+ r = engine.evaluate_attrs("A", ["b", "c", "e", "f"])
729
+ r.should == [2, 3, 456, [2,3]]
729
730
  end
730
731
 
731
732
  it "can eval indexing 2" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delorean_lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.00
4
+ version: 0.1.01
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-19 00:00:00.000000000 Z
12
+ date: 2013-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: treetop