Class: Apps::Adapters::Gmail::Markup::Base
- Inherits:
-
Object
- Object
- Apps::Adapters::Gmail::Markup::Base
show all
- Defined in:
- lib/apps/adapters/gmail/markup/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(**attrs) ⇒ Base
Returns a new instance of Base.
8
9
10
|
# File 'lib/apps/adapters/gmail/markup/base.rb', line 8
def initialize(**attrs)
attrs.each { |attr, value| instance_variable_set(:"@#{attr}", value) }
end
|
Instance Method Details
#as_json ⇒ Object
16
17
18
|
# File 'lib/apps/adapters/gmail/markup/base.rb', line 16
def as_json
{ "@type" => type }
end
|
#to_json(pretty: false) ⇒ Object
20
21
22
|
# File 'lib/apps/adapters/gmail/markup/base.rb', line 20
def to_json(pretty: false)
pretty ? JSON.pretty_generate(as_json) : JSON.dump(as_json)
end
|
#type ⇒ Object
12
13
14
|
# File 'lib/apps/adapters/gmail/markup/base.rb', line 12
def type
@type ||= self.class.name.split('::')[-1]
end
|