class Slack::BlockKit::CompositionObjects::OptionGroup
Attributes
label[R]
options[R]
Public Class Methods
[](hash)
click to toggle source
# 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.options.method(:<<)) end end
new()
click to toggle source
# File lib/slack/block_kit/composition_objects/option_group.rb, line 16 def initialize @options = TypeRestrictedArray.new(Option) end
Public Instance Methods
label=(obj)
click to toggle source
# File lib/slack/block_kit/composition_objects/option_group.rb, line 20 def label=(obj) raise TypeError, 'label must be a Text Object' unless obj.is_a?(Text) raise RangeError, 'label is max 75 characters' unless obj.text.size <= 75 @label = obj end
to_h()
click to toggle source
# File lib/slack/block_kit/composition_objects/option_group.rb, line 27 def to_h { label: label.to_h, options: options.map(&:to_h) } end