Class: MsTeamsHermes::Components::Column

Inherits:
Base
  • Object
show all
Defined in:
lib/msteams_hermes/components/column.rb

Overview

A class representing Microsoft’s Column object adaptivecards.io/explorer/Column.html

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items:, width: "auto") ⇒ Column

Returns a new instance of Column.



18
19
20
21
22
23
# File 'lib/msteams_hermes/components/column.rb', line 18

def initialize(items:, width: "auto")
  @items = items
  raise "Column `items` must be an Array" unless @items.is_a? Array

  @width = width
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



16
17
18
# File 'lib/msteams_hermes/components/column.rb', line 16

def items
  @items
end

#widthObject (readonly)

Returns the value of attribute width.



16
17
18
# File 'lib/msteams_hermes/components/column.rb', line 16

def width
  @width
end

Instance Method Details

#to_hashObject



25
26
27
28
29
30
31
# File 'lib/msteams_hermes/components/column.rb', line 25

def to_hash
  {
    type: "Column",
    width:,
    items: items.map(&:to_hash)
  }
end