forwarder19 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/forwarder.rb CHANGED
@@ -4,10 +4,10 @@ require 'forwarder/params'
4
4
  module Forwarder
5
5
 
6
6
  # How forward works:
7
- # The parameters are analyzied by the Params object by means of the `prepare_forward`
8
- # method. The `prepare_forward` method makes have use of the Argument object which
7
+ # The parameters are analyzed by the Params object by means of the `prepare_forward`
8
+ # method. The `prepare_forward` method makes havy use of the Argument object which
9
9
  # implements a query API for what the given arguments allow the forwarder to do.
10
- # And eventually the `forward!` method realises the delegation
10
+ # And eventually the `forward!` method realises the delegation.
11
11
  def forward *args, &blk
12
12
  params = Forwarder::Params.new self
13
13
  params.prepare_forward( *args, &blk )
@@ -32,10 +32,11 @@ module Forwarder
32
32
  a = arguments
33
33
  forwardee.module_eval do
34
34
  define_method a.message do |*args, &blk|
35
- args = a.before.(*args) if a.before?
35
+ args = instance_exec( *args, &a.before ) if a.before?
36
+
36
37
  a.object_target( self )
37
38
  .send( a.translation( a.message ), *a.complete_args(*args), &a.lambda( blk ) ).tap do | result |
38
- break a.after.( result ) if a.after?
39
+ break instance_exec( result, &a.after ) if a.after?
39
40
  end
40
41
  end
41
42
  end
@@ -49,11 +50,11 @@ module Forwarder
49
50
  sr = symbolic_receiver
50
51
  forwardee.module_eval do
51
52
  define_method a.message do |*args, &blk|
52
- args = a.before.(*args) if a.before?
53
+ args = instance_exec( *args, &a.before ) if a.before?
53
54
  sr
54
55
  .( self, a.target )
55
56
  .send( a.translation( a.message ), *a.complete_args(*args), &a.lambda( blk ) ).tap do | result |
56
- break a.after.( result ) if a.after?
57
+ break instance_exec( result, &a.after ) if a.after?
57
58
  end
58
59
  end
59
60
  end
@@ -1,3 +1,3 @@
1
1
  module Forwarder
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end # module Forwarder
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forwarder19
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-10 00:00:00.000000000Z
12
+ date: 2013-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lab419_core
16
- requirement: &79251030 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,62 +21,44 @@ dependencies:
21
21
  version: 0.0.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *79251030
25
- - !ruby/object:Gem::Dependency
26
- name: ruby-debug19
27
- requirement: &79250720 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
28
25
  none: false
29
26
  requirements:
30
27
  - - ~>
31
28
  - !ruby/object:Gem::Version
32
- version: '0.11'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *79250720
29
+ version: 0.0.3
36
30
  - !ruby/object:Gem::Dependency
37
- name: rake
38
- requirement: &79250430 !ruby/object:Gem::Requirement
31
+ name: pry
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
34
  requirements:
41
35
  - - ~>
42
36
  - !ruby/object:Gem::Version
43
- version: 0.9.2.2
37
+ version: '0.9'
44
38
  type: :development
45
39
  prerelease: false
46
- version_requirements: *79250430
47
- - !ruby/object:Gem::Dependency
48
- name: rspec
49
- requirement: &79250140 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
50
41
  none: false
51
42
  requirements:
52
43
  - - ~>
53
44
  - !ruby/object:Gem::Version
54
- version: 2.9.0
55
- type: :development
56
- prerelease: false
57
- version_requirements: *79250140
45
+ version: '0.9'
58
46
  - !ruby/object:Gem::Dependency
59
- name: maruku
60
- requirement: &79249860 !ruby/object:Gem::Requirement
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
61
49
  none: false
62
50
  requirements:
63
51
  - - ~>
64
52
  - !ruby/object:Gem::Version
65
- version: 0.6.0
53
+ version: 2.9.0
66
54
  type: :development
67
55
  prerelease: false
68
- version_requirements: *79249860
69
- - !ruby/object:Gem::Dependency
70
- name: wirble
71
- requirement: &79249630 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
72
57
  none: false
73
58
  requirements:
74
59
  - - ~>
75
60
  - !ruby/object:Gem::Version
76
- version: 0.1.3
77
- type: :development
78
- prerelease: false
79
- version_requirements: *79249630
61
+ version: 2.9.0
80
62
  description: ! "Ruby's core Forwardable gets the job done(barely) and produces most
81
63
  unreadable code. \n\n Forwarder19 not only is more readable, much more feature
82
64
  rich, but also slightly faster, meaning you can use it without performance penalty.\n\n
@@ -87,13 +69,13 @@ executables: []
87
69
  extensions: []
88
70
  extra_rdoc_files: []
89
71
  files:
90
- - lib/forwarder/arguments.rb
91
- - lib/forwarder/compiler.rb
92
- - lib/forwarder/meta.rb
93
- - lib/forwarder/params.rb
72
+ - lib/forwarder.rb
94
73
  - lib/forwarder/evaller.rb
74
+ - lib/forwarder/arguments.rb
95
75
  - lib/forwarder/version.rb
96
- - lib/forwarder.rb
76
+ - lib/forwarder/params.rb
77
+ - lib/forwarder/meta.rb
78
+ - lib/forwarder/compiler.rb
97
79
  - LICENSE
98
80
  - README.md
99
81
  homepage: https://github.com/RobertDober/Forwarder19
@@ -108,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
90
  requirements:
109
91
  - - ! '>='
110
92
  - !ruby/object:Gem::Version
111
- version: 1.9.2
93
+ version: 1.9.3
112
94
  required_rubygems_version: !ruby/object:Gem::Requirement
113
95
  none: false
114
96
  requirements:
@@ -117,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
99
  version: '0'
118
100
  requirements: []
119
101
  rubyforge_project:
120
- rubygems_version: 1.8.11
102
+ rubygems_version: 1.8.25
121
103
  signing_key:
122
104
  specification_version: 3
123
105
  summary: Delegation And AOP Filters For It