objective-ruby 0.0.2 → 0.0.3

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.
@@ -31,7 +31,7 @@ module ObjectiveRuby
31
31
  end
32
32
  end
33
33
 
34
- block.call block_input
34
+ self.instance_exec block_input, &block
35
35
  end
36
36
  end
37
37
 
@@ -54,7 +54,7 @@ module ObjectiveRuby
54
54
  end
55
55
  end
56
56
 
57
- block.call block_input
57
+ self.instance_exec block_input, &block
58
58
  end
59
59
  end
60
60
 
@@ -79,7 +79,7 @@ module ObjectiveRuby
79
79
  end
80
80
  end
81
81
 
82
- block.call block_input
82
+ self.instance_exec block_input, &block
83
83
  end
84
84
  end
85
85
 
@@ -100,7 +100,7 @@ module ObjectiveRuby
100
100
  end
101
101
  end
102
102
 
103
- block.call block_input
103
+ self.instance_exec block_input, &block
104
104
  end
105
105
  end
106
106
  end
@@ -1,3 +1,3 @@
1
1
  module ObjectiveRuby
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,6 +7,10 @@ require_relative '../lib/objective-ruby'
7
7
  class Test
8
8
  include ObjectiveRuby
9
9
 
10
+ def initialize
11
+ @local = 'set!'
12
+ end
13
+
10
14
  objr :objr_method, foo: String, bar: Fixnum do |input|
11
15
  input
12
16
  end
@@ -22,6 +26,22 @@ class Test
22
26
  objc_d :objc_d_method, with_foo: :foo, also_bar: :bar do |input|
23
27
  input
24
28
  end
29
+
30
+ objr :objr_local do |input|
31
+ @local
32
+ end
33
+
34
+ objr_d :objr_d_local do |input|
35
+ @local
36
+ end
37
+
38
+ objc :objc_local do |input|
39
+ @local
40
+ end
41
+
42
+ objc_d :objc_d_local do |input|
43
+ @local
44
+ end
25
45
  end
26
46
 
27
47
  describe ObjectiveRuby do
@@ -33,7 +53,12 @@ describe ObjectiveRuby do
33
53
  describe 'self.objr' do
34
54
  it 'should do the right thing with correct input' do
35
55
  result = @test.objr_method with_foo: 'hello', and_bar: 12
36
- result.must_equal foo: 'hello', bar: 12
56
+ result.must_equal foo: 'hello', bar: 12
57
+ end
58
+
59
+ it 'should have access to instance variables' do
60
+ result = @test.objr_local
61
+ result.must_equal 'set!'
37
62
  end
38
63
 
39
64
  it 'should allow for interchangable prefixes' do
@@ -70,6 +95,11 @@ describe ObjectiveRuby do
70
95
  result.must_equal foo: 'hello', bar: 12
71
96
  end
72
97
 
98
+ it 'should have access to instance variables' do
99
+ result = @test.objr_d_local
100
+ result.must_equal 'set!'
101
+ end
102
+
73
103
  it 'should allow for duck typing' do
74
104
  now = DateTime.now
75
105
  result = @test.objr_d_method with_foo: now , and_bar: 'something'
@@ -102,6 +132,11 @@ describe ObjectiveRuby do
102
132
  result.must_equal foo: 'hello', bar: 12
103
133
  end
104
134
 
135
+ it 'should have access to instance variables' do
136
+ result = @test.objc_local
137
+ result.must_equal 'set!'
138
+ end
139
+
105
140
  it 'should raise an error for missing parameters' do
106
141
  error = ( -> { @test.objc_method(with_foo: 'hello') }.must_raise ArgumentError )
107
142
  error.message.must_equal 'missing input field also_bar'
@@ -127,6 +162,11 @@ describe ObjectiveRuby do
127
162
  result.must_equal foo: 'hello', bar: 12
128
163
  end
129
164
 
165
+ it 'should have access to instance variables' do
166
+ result = @test.objc_d_local
167
+ result.must_equal 'set!'
168
+ end
169
+
130
170
  it 'should allow for duck typing' do
131
171
  now = DateTime.now
132
172
  result = @test.objc_d_method with_foo: now , also_bar: 'something'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: objective-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: