Class: AsciiPress::Renderer::Rendering
- Inherits:
-
Object
- Object
- AsciiPress::Renderer::Rendering
- Defined in:
- lib/ascii_press.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #attribute_exists?(name) ⇒ Boolean
- #attribute_value(name, default = nil) ⇒ Object
-
#initialize(html, doc, data) ⇒ Rendering
constructor
A new instance of Rendering.
- #list_attribute_value(name, default = []) ⇒ Object
Constructor Details
#initialize(html, doc, data) ⇒ Rendering
Returns a new instance of Rendering.
24 25 26 27 28 |
# File 'lib/ascii_press.rb', line 24 def initialize(html, doc, data) @html = html @doc = doc @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
21 22 23 |
# File 'lib/ascii_press.rb', line 21 def data @data end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
21 22 23 |
# File 'lib/ascii_press.rb', line 21 def doc @doc end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
21 22 23 |
# File 'lib/ascii_press.rb', line 21 def html @html end |
#tags ⇒ Object
Returns the value of attribute tags.
22 23 24 |
# File 'lib/ascii_press.rb', line 22 def @tags end |
Instance Method Details
#attribute_exists?(name) ⇒ Boolean
43 44 45 |
# File 'lib/ascii_press.rb', line 43 def attribute_exists?(name) doc.attributes.key?(name.to_s) end |
#attribute_value(name, default = nil) ⇒ Object
30 31 32 |
# File 'lib/ascii_press.rb', line 30 def attribute_value(name, default = nil) doc.attributes[name.to_s] || default end |
#list_attribute_value(name, default = []) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/ascii_press.rb', line 34 def list_attribute_value(name, default = []) value = attribute_value(name, :VALUE_DOES_NOT_EXIST) if value == :VALUE_DOES_NOT_EXIST default else value.split(/\s*,\s*/) end end |