Class: Subroutine::Outputs::Configuration
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Subroutine::Outputs::Configuration
- Defined in:
- lib/subroutine/outputs/configuration.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ required: true }.freeze
Instance Attribute Summary collapse
-
#output_name ⇒ Object
readonly
Returns the value of attribute output_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(output_name, config) ⇒ Configuration
constructor
A new instance of Configuration.
- #inspect ⇒ Object
- #required? ⇒ Boolean
Constructor Details
#initialize(output_name, config) ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 |
# File 'lib/subroutine/outputs/configuration.rb', line 20 def initialize(output_name, config) @output_name = output_name super(DEFAULT_OPTIONS.merge(config)) end |
Instance Attribute Details
#output_name ⇒ Object (readonly)
Returns the value of attribute output_name.
18 19 20 |
# File 'lib/subroutine/outputs/configuration.rb', line 18 def output_name @output_name end |
Class Method Details
.from(field_name, options) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/subroutine/outputs/configuration.rb', line 7 def self.from(field_name, ) case when Subroutine::Outputs::Configuration .class.new(field_name, ) else new(field_name, ) end end |
Instance Method Details
#inspect ⇒ Object
31 32 33 |
# File 'lib/subroutine/outputs/configuration.rb', line 31 def inspect "#<#{self.class}:#{object_id} name=#{output_name} config=#{config.inspect}>" end |
#required? ⇒ Boolean
27 28 29 |
# File 'lib/subroutine/outputs/configuration.rb', line 27 def required? !!config[:required] end |