Class: Jahuty::Resource::Render
- Inherits:
-
Object
- Object
- Jahuty::Resource::Render
- Defined in:
- lib/jahuty/resource/render.rb
Overview
A snippet’s rendered content.
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#snippet_id ⇒ Object
Returns the value of attribute snippet_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(content:, snippet_id:) ⇒ Render
constructor
A new instance of Render.
- #to_s ⇒ Object
Constructor Details
#initialize(content:, snippet_id:) ⇒ Render
Returns a new instance of Render.
9 10 11 12 |
# File 'lib/jahuty/resource/render.rb', line 9 def initialize(content:, snippet_id:) @content = content @snippet_id = snippet_id end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
7 8 9 |
# File 'lib/jahuty/resource/render.rb', line 7 def content @content end |
#snippet_id ⇒ Object
Returns the value of attribute snippet_id.
7 8 9 |
# File 'lib/jahuty/resource/render.rb', line 7 def snippet_id @snippet_id end |
Class Method Details
.from(data) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/jahuty/resource/render.rb', line 14 def self.from(data) raise ArgumentError.new, 'Key :content missing' unless data.key?(:content) raise ArgumentError.new, 'Key :snippet_id missing' unless data.key?(:snippet_id) Render.new(**data.slice(:content, :snippet_id)) end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/jahuty/resource/render.rb', line 21 def to_s @content end |