Class: MrDarcy::Role
- Inherits:
-
Object
- Object
- MrDarcy::Role
- Defined in:
- lib/mr_darcy/role.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #clean(player) ⇒ Object
-
#initialize(name, opts = {}, &block) ⇒ Role
constructor
A new instance of Role.
- #pollute(player) ⇒ Object
Constructor Details
#initialize(name, opts = {}, &block) ⇒ Role
Returns a new instance of Role.
5 6 7 8 9 |
# File 'lib/mr_darcy/role.rb', line 5 def initialize name, opts={}, &block self.name = name self. = opts @module = Module.new(&block) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/mr_darcy/role.rb', line 3 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/mr_darcy/role.rb', line 3 def @options end |
Instance Method Details
#clean(player) ⇒ Object
21 22 23 |
# File 'lib/mr_darcy/role.rb', line 21 def clean player clean_singleton_methods player unless jruby? end |
#pollute(player) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/mr_darcy/role.rb', line 11 def pollute player guard_against_false_players player if jruby? pollute_with_module_extension player else pollute_with_singleton_methods player end end |