Class: Nyanko::UnitProxy
- Inherits:
-
Object
- Object
- Nyanko::UnitProxy
- Defined in:
- lib/nyanko/unit_proxy.rb
Instance Attribute Summary collapse
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Class Method Summary collapse
Instance Method Summary collapse
- #active?(options = {}) ⇒ Boolean
-
#initialize(unit, context) ⇒ UnitProxy
constructor
A new instance of UnitProxy.
Constructor Details
#initialize(unit, context) ⇒ UnitProxy
Returns a new instance of UnitProxy.
11 12 13 14 |
# File 'lib/nyanko/unit_proxy.rb', line 11 def initialize(unit, context) @unit = unit @context = context end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
26 27 28 |
# File 'lib/nyanko/unit_proxy.rb', line 26 def method_missing(method_name, *args, &block) @context.send("#{prefix}#{method_name}", *args, &block) end |
Instance Attribute Details
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
5 6 7 |
# File 'lib/nyanko/unit_proxy.rb', line 5 def unit @unit end |
Class Method Details
.generate_prefix(unit_name) ⇒ Object
7 8 9 |
# File 'lib/nyanko/unit_proxy.rb', line 7 def self.generate_prefix(unit_name) "__#{unit_name}_" end |
Instance Method Details
#active?(options = {}) ⇒ Boolean
16 17 18 |
# File 'lib/nyanko/unit_proxy.rb', line 16 def active?( = {}) @unit.active?(@context, ) end |