Class: Plivo::Section
- Inherits:
-
Object
- Object
- Plivo::Section
- Defined in:
- lib/plivo/interactive.rb
Instance Attribute Summary collapse
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title: nil, rows: nil) ⇒ Section
constructor
A new instance of Section.
- #to_hash ⇒ Object
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
#rows ⇒ Object
Returns the value of attribute rows.
107 108 109 |
# File 'lib/plivo/interactive.rb', line 107 def rows @rows end |
#title ⇒ Object
Returns the value of attribute title.
107 108 109 |
# File 'lib/plivo/interactive.rb', line 107 def title @title end |
Instance Method Details
#to_hash ⇒ Object
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 |