role_playing 0.0.3 → 0.0.4

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.
@@ -24,8 +24,7 @@ end
24
24
  class Object
25
25
  def in_roles(*roles, &block)
26
26
  extended = roles.inject(self) { |extended, role| role.new(extended) }
27
- extended.instance_eval(&block) if block_given?
28
- extended
27
+ block_given? ? yield(extended) : extended
29
28
  end
30
29
  def in_role(role, &block)
31
30
  in_roles(*role, &block)
@@ -1,3 +1,3 @@
1
1
  module RolePlaying
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -75,6 +75,13 @@ describe RolePlaying do
75
75
  subject.role_player.should_not respond_to(:two_fields)
76
76
  end
77
77
 
78
+ it "#in_role takes a block and returns the result" do
79
+ two_fields = bare_object.in_role(MyRole) do |role|
80
+ role.two_fields
81
+ end
82
+ two_fields.should == "#{bare_object.field_1} #{bare_object.field_2}"
83
+ end
84
+
78
85
  end
79
86
 
80
87
  context MoneyTransfer do
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: