Class: Slack::BlockKit::CompositionObjects::OptionGroup
- Inherits:
-
Object
- Object
- Slack::BlockKit::CompositionObjects::OptionGroup
- Defined in:
- lib/slack/block_kit/composition_objects/option_group.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ OptionGroup
constructor
A new instance of OptionGroup.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ OptionGroup
Returns a new instance of OptionGroup.
16 17 18 |
# File 'lib/slack/block_kit/composition_objects/option_group.rb', line 16 def initialize @options = TypeRestrictedArray.new(Option) end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
7 8 9 |
# File 'lib/slack/block_kit/composition_objects/option_group.rb', line 7 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/slack/block_kit/composition_objects/option_group.rb', line 7 def @options end |
Class Method Details
.[](hash) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/slack/block_kit/composition_objects/option_group.rb', line 9 def self.[](hash) new.tap do |object| object.label = hash.fetch(:label) hash[:options].each(&object..method(:<<)) end end |
Instance Method Details
#to_h ⇒ Object
27 28 29 30 |
# File 'lib/slack/block_kit/composition_objects/option_group.rb', line 27 def to_h { label: label.to_h, options: .map(&:to_h) } end |