Class: Plivo::Template
- Inherits:
-
Object
- Object
- Plivo::Template
- Defined in:
- lib/plivo/template.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
Returns the value of attribute components.
-
#language ⇒ Object
Returns the value of attribute language.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name: nil, language: nil, components: nil) ⇒ Template
constructor
A new instance of Template.
- #to_hash ⇒ Object
Constructor Details
#initialize(name: nil, language: nil, components: nil) ⇒ Template
Returns a new instance of Template.
8 9 10 11 12 |
# File 'lib/plivo/template.rb', line 8 def initialize(name: nil, language: nil, components: nil) @name = name @language = language @components = components end |
Instance Attribute Details
#components ⇒ Object
Returns the value of attribute components.
6 7 8 |
# File 'lib/plivo/template.rb', line 6 def components @components end |
#language ⇒ Object
Returns the value of attribute language.
6 7 8 |
# File 'lib/plivo/template.rb', line 6 def language @language end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/plivo/template.rb', line 6 def name @name end |
Instance Method Details
#to_hash ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/plivo/template.rb', line 14 def to_hash { name: @name, language: @language, components: @components&.map(&:to_hash)&.reject { |h| h.values.all?(&:nil?) } }.reject { |_, v| v.nil? } end |