Class: Plivo::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/plivo/interactive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: nil, rows: nil) ⇒ Section

Returns a new instance of Section.



109
110
111
112
# File 'lib/plivo/interactive.rb', line 109

def initialize(title: nil, rows: nil)
  @title = title
  @rows = rows ? rows.map { |r| Row.new(**r) } : []
end

Instance Attribute Details

#rowsObject

Returns the value of attribute rows.



107
108
109
# File 'lib/plivo/interactive.rb', line 107

def rows
  @rows
end

#titleObject

Returns the value of attribute title.



107
108
109
# File 'lib/plivo/interactive.rb', line 107

def title
  @title
end

Instance Method Details

#to_hashObject



114
115
116
117
118
119
# File 'lib/plivo/interactive.rb', line 114

def to_hash
  {
    title: @title,
    rows: @rows.map(&:to_hash),
  }.reject { |_, v| v.nil? }
end