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.
25 26 27 28 29 |
# File 'lib/ascii_press.rb', line 25 def initialize(html, doc, data) @html = html @doc = doc @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
22 23 24 |
# File 'lib/ascii_press.rb', line 22 def data @data end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
22 23 24 |
# File 'lib/ascii_press.rb', line 22 def doc @doc end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
22 23 24 |
# File 'lib/ascii_press.rb', line 22 def html @html end |
#tags ⇒ Object
Returns the value of attribute tags.
23 24 25 |
# File 'lib/ascii_press.rb', line 23 def end |
Instance Method Details
#attribute_exists?(name) ⇒ Boolean
44 45 46 |
# File 'lib/ascii_press.rb', line 44 def attribute_exists?(name) doc.attributes.key?(name.to_s) end |
#attribute_value(name, default = nil) ⇒ Object
31 32 33 |
# File 'lib/ascii_press.rb', line 31 def attribute_value(name, default = nil) doc.attributes[name.to_s] || default end |
#list_attribute_value(name, default = []) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/ascii_press.rb', line 35 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 |