Class: Flipper::Types::Actor
- Inherits:
-
Flipper::Type
- Object
- Flipper::Type
- Flipper::Types::Actor
- Defined in:
- lib/flipper/types/actor.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(thing) ⇒ Actor
constructor
A new instance of Actor.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to?(*args) ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(thing) ⇒ Actor
Returns a new instance of Actor.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/flipper/types/actor.rb', line 20 def initialize(thing) raise ArgumentError, "thing cannot be nil" if thing.nil? @thing = thing @identifier = if thing.respond_to?(:identifier) thing.identifier else thing end.to_i end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
39 40 41 |
# File 'lib/flipper/types/actor.rb', line 39 def method_missing(name, *args, &block) @thing.send name, *args, &block end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
18 19 20 |
# File 'lib/flipper/types/actor.rb', line 18 def identifier @identifier end |
Class Method Details
Instance Method Details
#respond_to?(*args) ⇒ Boolean
35 36 37 |
# File 'lib/flipper/types/actor.rb', line 35 def respond_to?(*args) super || @thing.respond_to?(*args) end |
#value ⇒ Object
31 32 33 |
# File 'lib/flipper/types/actor.rb', line 31 def value @identifier end |