Class: Sublayer::Components::OutputAdapters::StringSelectionFromList
- Inherits:
-
Object
- Object
- Sublayer::Components::OutputAdapters::StringSelectionFromList
- Defined in:
- lib/sublayer/components/output_adapters/string_selection_from_list.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ StringSelectionFromList
constructor
A new instance of StringSelectionFromList.
- #load_instance_data(generator) ⇒ Object
- #properties ⇒ Object
Constructor Details
#initialize(options) ⇒ StringSelectionFromList
Returns a new instance of StringSelectionFromList.
7 8 9 10 11 |
# File 'lib/sublayer/components/output_adapters/string_selection_from_list.rb', line 7 def initialize() @name = [:name] @description = [:description] @list = [:options] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/sublayer/components/output_adapters/string_selection_from_list.rb', line 5 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/sublayer/components/output_adapters/string_selection_from_list.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/sublayer/components/output_adapters/string_selection_from_list.rb', line 5 def @options end |
Instance Method Details
#load_instance_data(generator) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sublayer/components/output_adapters/string_selection_from_list.rb', line 17 def load_instance_data(generator) case @list when Proc @list = generator.instance_exec(&@list) when Symbol @list = generator.send(@list) else @list end end |
#properties ⇒ Object
13 14 15 |
# File 'lib/sublayer/components/output_adapters/string_selection_from_list.rb', line 13 def properties [OpenStruct.new(name: @name, type: 'string', description: @description, required: true, enum: @list)] end |