Class: MsTeamsHermes::Components::Container
- Defined in:
- lib/msteams_hermes/components/container.rb
Overview
A class representing Microsoft’s Container object adaptivecards.io/explorer/Container.html
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#select_action ⇒ Object
readonly
Returns the value of attribute select_action.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(items:, style: Style::ContainerStyle::DEFAULT, select_action: nil) ⇒ Container
constructor
A new instance of Container.
- #to_hash ⇒ Object
Constructor Details
#initialize(items:, style: Style::ContainerStyle::DEFAULT, select_action: nil) ⇒ Container
Returns a new instance of Container.
19 20 21 22 23 24 25 |
# File 'lib/msteams_hermes/components/container.rb', line 19 def initialize(items:, style: Style::ContainerStyle::DEFAULT, select_action: nil) @items = items raise "Container `items` must be an Array" unless @items.is_a? Array @style = style @select_action = select_action end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
17 18 19 |
# File 'lib/msteams_hermes/components/container.rb', line 17 def items @items end |
#select_action ⇒ Object (readonly)
Returns the value of attribute select_action.
17 18 19 |
# File 'lib/msteams_hermes/components/container.rb', line 17 def select_action @select_action end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
17 18 19 |
# File 'lib/msteams_hermes/components/container.rb', line 17 def style @style end |
Instance Method Details
#to_hash ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/msteams_hermes/components/container.rb', line 27 def to_hash { type: "Container", style:, selectAction: select_action&.to_hash, items: items.map(&:to_hash) } end |