Class: SendGrid::Section
- Inherits:
-
Object
- Object
- SendGrid::Section
- Defined in:
- lib/sendgrid/helpers/mail/section.rb
Instance Attribute Summary collapse
-
#section ⇒ Object
Returns the value of attribute section.
Instance Method Summary collapse
-
#initialize(key: nil, value: nil) ⇒ Section
constructor
A new instance of Section.
- #to_json ⇒ Object
Constructor Details
#initialize(key: nil, value: nil) ⇒ Section
Returns a new instance of Section.
7 8 9 10 |
# File 'lib/sendgrid/helpers/mail/section.rb', line 7 def initialize(key: nil, value: nil) @section = {} key.nil? || value.nil? ? @section = nil : @section[key] = value end |
Instance Attribute Details
#section ⇒ Object
Returns the value of attribute section.
5 6 7 |
# File 'lib/sendgrid/helpers/mail/section.rb', line 5 def section @section end |
Instance Method Details
#to_json ⇒ Object
12 13 14 15 16 |
# File 'lib/sendgrid/helpers/mail/section.rb', line 12 def to_json(*) { 'section' => section }.delete_if { |_, value| value.to_s.strip == '' } end |