Class: Flipper::Types::Actor
- Inherits:
-
Flipper::Type
- Object
- Flipper::Type
- Flipper::Types::Actor
- Defined in:
- lib/flipper/types/actor.rb
Instance Attribute Summary collapse
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
Attributes inherited from Flipper::Type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(actor) ⇒ Actor
constructor
A new instance of Actor.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to?(*args) ⇒ Boolean
Methods inherited from Flipper::Type
Constructor Details
#initialize(actor) ⇒ Actor
Returns a new instance of Actor.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/flipper/types/actor.rb', line 11 def initialize(actor) raise ArgumentError, 'actor cannot be nil' if actor.nil? unless actor.respond_to?(:flipper_id) raise ArgumentError, "#{actor.inspect} must respond to flipper_id, but does not" end @actor = actor @value = actor.flipper_id.to_s end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
27 28 29 |
# File 'lib/flipper/types/actor.rb', line 27 def method_missing(name, *args, **kwargs, &block) @actor.send name, *args, **kwargs, &block end |
Instance Attribute Details
#actor ⇒ Object (readonly)
Returns the value of attribute actor.
9 10 11 |
# File 'lib/flipper/types/actor.rb', line 9 def actor @actor end |
Class Method Details
.wrappable?(actor) ⇒ Boolean
4 5 6 7 |
# File 'lib/flipper/types/actor.rb', line 4 def self.wrappable?(actor) return false if actor.nil? actor.respond_to?(:flipper_id) end |
Instance Method Details
#respond_to?(*args) ⇒ Boolean
22 23 24 |
# File 'lib/flipper/types/actor.rb', line 22 def respond_to?(*args) super || @actor.respond_to?(*args) end |