delorean_lang 0.4.00 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb9bc757d323ed7d4388c688b739e9db16b4bf5c
4
- data.tar.gz: 00d96513a6ad9a715b6b10e049bab9d3c7bb810e
3
+ metadata.gz: 5e16424d7fcee1580734a4acd92800dfe12d6843
4
+ data.tar.gz: b0e838fd40d2dc67e56c6a0902ac18c6334e62cb
5
5
  SHA512:
6
- metadata.gz: '068413a5efef120c6351a8cfeb8cdda51c671cde3bb7b0fb5cde0303b7dbb989d33d214505d31b47557a32a60e6ceff0e33c526c9d68d51b51d150109c0a96ff'
7
- data.tar.gz: 46cdcda1e1c2af6019f33b498fd3acd7f9257b79969f2e74706283cfa93b560d54c520194ad8a888c10e844379e9d6c63f02037c3b0e3abd4dbe8171166d8577
6
+ metadata.gz: c206b29669d8089786b2e06bc33b2ed5f83c38d5c8feb648282b316aee98fb333cba456f042f321c3f89196e28ee0635165c49c1ce2a8dc2fcdf6f677cb738cd
7
+ data.tar.gz: 703a9c28bdfb4c52f0d242583a1003d1649601be87e06552dab7f8a860cd4193c5b3c22e3bac0dc1d23c452512f7567af438e4982f0d31e00653358b09367250
data/lib/delorean/base.rb CHANGED
@@ -236,10 +236,7 @@ module Delorean
236
236
  end
237
237
 
238
238
  cls = obj.class
239
- sig = cls < Delorean::Model &&
240
- cls.ancestors.lazy.map do |an|
241
- cls.delorean_instance_methods[[an, msg]]
242
- end.find{|i|i} || RUBY_WHITELIST[msg]
239
+ sig = RUBY_WHITELIST[msg]
243
240
 
244
241
  raise "no such method #{method}" unless sig
245
242
 
@@ -22,14 +22,6 @@ module Delorean
22
22
  self.const_set(name.to_s.upcase+Delorean::SIG, sig)
23
23
  end
24
24
  end
25
-
26
- def delorean_instance_method(name, sig = nil)
27
- delorean_instance_methods[[self, name.to_sym]] = [self, *sig].compact
28
- end
29
-
30
- def delorean_instance_methods
31
- @@delorean_instance_methods ||= {}
32
- end
33
25
  end
34
26
  end
35
27
  end
@@ -1,3 +1,3 @@
1
1
  module Delorean
2
- VERSION = "0.4.00"
2
+ VERSION = "0.4.1"
3
3
  end
data/spec/eval_spec.rb CHANGED
@@ -284,45 +284,6 @@ describe "Delorean" do
284
284
  r.should == "CRJ-1.234"
285
285
  end
286
286
 
287
- it "should be able to access delorean_instance_method fns using .x syntax" do
288
- engine.parse defn("A:",
289
- ' b = Dummy.i_just_met_you("I Really Like You", 1.234).name3("Run Away with Me")',
290
- )
291
- r = engine.evaluate("A", "b")
292
- r.should == "I Really Like You-1.234-Run Away with Me"
293
- end
294
-
295
- it "delorean_instance_fn inheritance test 1" do
296
- engine.parse defn("A:",
297
- ' b = DummyChild.hello.name3("child calling parent\'s dim")',
298
- )
299
- r = engine.evaluate("A", "b")
300
- r.should == "child-99999.0-child calling parent's dim"
301
- end
302
- it "delorean_instance_fn inheritance test 2" do
303
- engine.parse defn("A:",
304
- ' b = DummyChild.hello.name4("child calling own dim")',
305
- )
306
- r = engine.evaluate("A", "b")
307
- r.should == "#4 child-99999.0-child calling own dim"
308
- end
309
- it "delorean_instance_fn inheritance test 3" do
310
- # calling unrelated dim
311
- engine.parse defn("A:",
312
- " b = M::LittleDummy.sup.foob",
313
- )
314
- r = engine.evaluate("A", "b")
315
- r.should == "bar"
316
- end
317
- it "delorean_instance_fn inheritance test 4" do
318
- # parent calling its own dim (that a child also has)
319
- engine.parse defn("A:",
320
- ' b = Dummy.i_just_met_you("Foo",321).name4("Bar")',
321
- )
322
- r = engine.evaluate("A", "b")
323
- r.should == "Four Foo-321.0-Bar"
324
- end
325
-
326
287
  it "should be able to get attr on Hash objects using a.b syntax" do
327
288
  engine.parse defn("A:",
328
289
  ' b = Dummy.i_threw_a_hash_in_the_well()',
data/spec/spec_helper.rb CHANGED
@@ -78,18 +78,6 @@ class Dummy < ActiveRecord::Base
78
78
  [a, b]
79
79
  end
80
80
 
81
- def name3 other_name
82
- "#{name}-#{number.round(4)}-#{other_name}"
83
- end
84
-
85
- delorean_instance_method :name3, String
86
-
87
- def name4 other_name
88
- "Four #{name}-#{number.round(4)}-#{other_name}"
89
- end
90
-
91
- delorean_instance_method :name4, String
92
-
93
81
  @@foo = 0
94
82
  delorean_fn :side_effect, sig: 0 do
95
83
  @@foo += 1
@@ -105,11 +93,6 @@ class DummyChild < Dummy
105
93
  DummyChild.new(name: "child", number: 99999)
106
94
  end
107
95
  HELLO_SIG = [0, 0]
108
- def name4 other_name
109
- "#4 #{name}-#{number.round(4)}-#{other_name}"
110
- end
111
-
112
- delorean_instance_method :name4, String
113
96
  end
114
97
 
115
98
  module M
@@ -124,12 +107,7 @@ module M
124
107
  LittleDummy.new
125
108
  end
126
109
  SUP_SIG = [0, 0]
127
- def foob
128
- "bar"
129
- end
130
- delorean_instance_method :foob
131
110
  end
132
-
133
111
  end
134
112
 
135
113
  Delorean::RUBY_WHITELIST.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delorean_lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.00
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-14 00:00:00.000000000 Z
11
+ date: 2018-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop