alephant-support 0.0.3 → 0.0.4

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: 23305bc386be8f6b9a030262178e3870886dd6c7
4
- data.tar.gz: 7ece0f4478a19de7df8bf865fcadfd0d49971a56
3
+ metadata.gz: b12ce0f16e247d7bceabcda5c885133dbcea9f88
4
+ data.tar.gz: 01e477890b88c2a608e9127b1107ad6055b468a2
5
5
  SHA512:
6
- metadata.gz: 4c4dfdd10cc493c8541c091e6fc2f28afcca69da115f113a06e6e80a462e90ecf8925df4237938c6d0ed7659c408eb38774d9e733468ecc775a0e07124f4013f
7
- data.tar.gz: 9c7c01d1c8bb2b77db717b446f4ffe7a423510f42f99c063a682473dec0e975fa7d0052ff978d48f4cfa14cc2ddd1d575332c003e18ccc7945aa955167aaa8fc
6
+ metadata.gz: 6f335abd6948b546af486d315d71f0200b96a0c16c877bc33d36994795fcb0b82e81c084daae4b0484391a26a4c345bdd2234c8fe7fc3a6c741c0ecfc0d2bd20
7
+ data.tar.gz: 9a5610b721d378d47239efd4332c5d709cc63b90a27f032f9a12df3c2058549eb1916a26875b77a3ca14643c0afc0a315a3c637cef70290e362f4dc3b6070b21
@@ -0,0 +1,19 @@
1
+ module Alephant
2
+ module Support
3
+ module AOP
4
+
5
+ def around(fn_name)
6
+ puts 'In around method'
7
+ old_method = instance_method(fn_name)
8
+ define_method(fn_name) do |*args|
9
+ yield :before, args if block_given?
10
+ old_method.bind(self).call(args).tap do |return_value|
11
+ args << return_value unless return_value.nil?
12
+ end
13
+ yield :after, args if block_given?
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Support
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
data/spec/aop_spec.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alephant::Support::AOP do
4
+ describe "#around(fn_name)" do
5
+ it "Overwrites the existing method with the block passed in, providing hooks for before and after the original method call" do
6
+
7
+ states = []
8
+
9
+ Test.around('test_method') do |state, args|
10
+ states << state
11
+ if state == :before
12
+ args.should eq(['test'])
13
+ elsif state == :after
14
+ args.should eq(['test', 'test_return'])
15
+ end
16
+ end
17
+
18
+ Test.new.test_method('test')
19
+ states.should include(:before, :after)
20
+
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,10 @@
1
+ require 'alephant/support/aop'
2
+
3
+ class Test
4
+ extend Alephant::Support::AOP
5
+
6
+ def test_method(arg)
7
+ 'test_return'
8
+ end
9
+
10
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,3 +3,4 @@ $: << File.join(File.dirname(__FILE__),"..", "lib")
3
3
  require 'pry'
4
4
  require 'alephant/support'
5
5
  require 'alephant/support/parser'
6
+ require_relative 'fixtures/test'
metadata CHANGED
@@ -1,155 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
15
  requirement: !ruby/object:Gem::Requirement
21
16
  requirements:
22
17
  - - '>='
23
18
  - !ruby/object:Gem::Version
24
19
  version: '0'
25
- prerelease: false
26
20
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: rspec-nc
21
+ prerelease: false
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
24
  - - '>='
32
25
  - !ruby/object:Gem::Version
33
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-nc
34
29
  requirement: !ruby/object:Gem::Requirement
35
30
  requirements:
36
31
  - - '>='
37
32
  - !ruby/object:Gem::Version
38
33
  version: '0'
39
- prerelease: false
40
34
  type: :development
41
- - !ruby/object:Gem::Dependency
42
- name: guard
35
+ prerelease: false
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - '>='
46
39
  - !ruby/object:Gem::Version
47
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard
48
43
  requirement: !ruby/object:Gem::Requirement
49
44
  requirements:
50
45
  - - '>='
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
- prerelease: false
54
48
  type: :development
55
- - !ruby/object:Gem::Dependency
56
- name: guard-rspec
49
+ prerelease: false
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
52
  - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
62
57
  requirement: !ruby/object:Gem::Requirement
63
58
  requirements:
64
59
  - - '>='
65
60
  - !ruby/object:Gem::Version
66
61
  version: '0'
67
- prerelease: false
68
62
  type: :development
69
- - !ruby/object:Gem::Dependency
70
- name: pry
63
+ prerelease: false
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
66
  - - '>='
74
67
  - !ruby/object:Gem::Version
75
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
76
71
  requirement: !ruby/object:Gem::Requirement
77
72
  requirements:
78
73
  - - '>='
79
74
  - !ruby/object:Gem::Version
80
75
  version: '0'
81
- prerelease: false
82
76
  type: :development
83
- - !ruby/object:Gem::Dependency
84
- name: pry-remote
77
+ prerelease: false
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
80
  - - '>='
88
81
  - !ruby/object:Gem::Version
89
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-remote
90
85
  requirement: !ruby/object:Gem::Requirement
91
86
  requirements:
92
87
  - - '>='
93
88
  - !ruby/object:Gem::Version
94
89
  version: '0'
95
- prerelease: false
96
90
  type: :development
97
- - !ruby/object:Gem::Dependency
98
- name: pry-nav
91
+ prerelease: false
99
92
  version_requirements: !ruby/object:Gem::Requirement
100
93
  requirements:
101
94
  - - '>='
102
95
  - !ruby/object:Gem::Version
103
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-nav
104
99
  requirement: !ruby/object:Gem::Requirement
105
100
  requirements:
106
101
  - - '>='
107
102
  - !ruby/object:Gem::Version
108
103
  version: '0'
109
- prerelease: false
110
104
  type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bundler
113
- version_requirements: !ruby/object:Gem::Requirement
113
+ requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.3'
118
- requirement: !ruby/object:Gem::Requirement
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
119
121
  requirements:
120
122
  - - ~>
121
123
  - !ruby/object:Gem::Version
122
124
  version: '1.3'
123
- prerelease: false
124
- type: :development
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
- version_requirements: !ruby/object:Gem::Requirement
127
+ requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
- requirement: !ruby/object:Gem::Requirement
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
133
135
  requirements:
134
136
  - - '>='
135
137
  - !ruby/object:Gem::Version
136
138
  version: '0'
137
- prerelease: false
138
- type: :development
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: jsonpath
141
- version_requirements: !ruby/object:Gem::Requirement
141
+ requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
- requirement: !ruby/object:Gem::Requirement
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
147
149
  requirements:
148
150
  - - '>='
149
151
  - !ruby/object:Gem::Version
150
152
  version: '0'
151
- prerelease: false
152
- type: :runtime
153
153
  description: Supporting classes for the alephant framework
154
154
  email:
155
155
  - stevenmajack@gmail.com
@@ -166,17 +166,20 @@ files:
166
166
  - Rakefile
167
167
  - alephant-support.gemspec
168
168
  - lib/alephant/support.rb
169
+ - lib/alephant/support/aop.rb
169
170
  - lib/alephant/support/dynamodb/table.rb
170
171
  - lib/alephant/support/jsonpath_lookup.rb
171
172
  - lib/alephant/support/parser.rb
172
173
  - lib/alephant/support/version.rb
174
+ - spec/aop_spec.rb
175
+ - spec/fixtures/test.rb
173
176
  - spec/parser_spec.rb
174
177
  - spec/spec_helper.rb
175
178
  homepage: ''
176
179
  licenses:
177
180
  - MIT
178
181
  metadata: {}
179
- post_install_message:
182
+ post_install_message:
180
183
  rdoc_options: []
181
184
  require_paths:
182
185
  - lib
@@ -191,11 +194,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
194
  - !ruby/object:Gem::Version
192
195
  version: '0'
193
196
  requirements: []
194
- rubyforge_project:
195
- rubygems_version: 2.1.9
196
- signing_key:
197
+ rubyforge_project:
198
+ rubygems_version: 2.2.2
199
+ signing_key:
197
200
  specification_version: 4
198
201
  summary: Supporting classes for the alephant framework
199
202
  test_files:
203
+ - spec/aop_spec.rb
204
+ - spec/fixtures/test.rb
200
205
  - spec/parser_spec.rb
201
206
  - spec/spec_helper.rb