Class: State::Options::Option
- Inherits:
-
Object
- Object
- State::Options::Option
- Defined in:
- lib/flow/state/options.rb
Instance Method Summary collapse
- #default_value ⇒ Object
-
#initialize(default:, &block) ⇒ Option
constructor
A new instance of Option.
Constructor Details
#initialize(default:, &block) ⇒ Option
Returns a new instance of Option.
34 35 36 |
# File 'lib/flow/state/options.rb', line 34 def initialize(default:, &block) @default_value = (default.nil? && block_given?) ? block : default end |
Instance Method Details
#default_value ⇒ Object
38 39 40 41 42 |
# File 'lib/flow/state/options.rb', line 38 def default_value return instance_eval(&@default_value) if @default_value.respond_to?(:call) @default_value end |