role_playing 0.0.9 → 0.1.0
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.
- data/README.md +4 -0
- data/lib/role_playing/context.rb +2 -2
- data/lib/role_playing/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -37,6 +37,10 @@ Using it is as simple as defining (usually) a context like so:
|
|
37
37
|
@to_account = to_account
|
38
38
|
end
|
39
39
|
def call(amount)
|
40
|
+
## this is a little contrived I know
|
41
|
+
## it could be easily implemented using
|
42
|
+
## increment/decrement methods - just
|
43
|
+
## showing the block syntax here
|
40
44
|
SourceAccount(@from_account) do |source_account|
|
41
45
|
DestinationAccount(@to_account).deposit(source_account.withdraw(amount))
|
42
46
|
end
|
data/lib/role_playing/context.rb
CHANGED
@@ -14,8 +14,8 @@ module RolePlaying
|
|
14
14
|
def role(name, parent=nil, &block)
|
15
15
|
parent = parent || RolePlaying::Role
|
16
16
|
klass = Class.new(parent, &block)
|
17
|
-
define_method(name) do
|
18
|
-
instance = klass.new(
|
17
|
+
define_method(name) do |*args, &role_block|
|
18
|
+
instance = klass.new(*args)
|
19
19
|
role_block.nil? ? instance : role_block.call(instance)
|
20
20
|
end
|
21
21
|
const_set name, klass
|
data/lib/role_playing/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: role_playing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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-02-
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.8.
|
105
|
+
rubygems_version: 1.8.25
|
106
106
|
signing_key:
|
107
107
|
specification_version: 3
|
108
108
|
summary: A ruby DCI implementation
|