Module: Sevgi::Graphics::Mixtures::Render::Renderer::Attributes::Hybrid Private
- Defined in:
- lib/sevgi/graphics/mixtures/render.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Hybrid attribute renderer.
Instance Method Summary collapse
-
#attributes(element, depth) ⇒ void
private
Renders attributes inline or in block form according to line length.
-
#attributes_as_block?(lines, depth) ⇒ Boolean
private
Reports whether attributes should be rendered in block form.
-
#linelength(lines, depth) ⇒ Integer
private
Returns the effective inline line length.
Instance Method Details
#attributes(element, depth) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Renders attributes inline or in block form according to line length.
36 37 38 39 40 41 42 |
# File 'lib/sevgi/graphics/mixtures/render.rb', line 36 def attributes(element, depth) if attributes_as_block?(lines = element.attributes.to_xml_lines, depth) attributes_block(element, depth, lines) else attributes_inline(element, depth, lines) end end |
#attributes_as_block?(lines, depth) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reports whether attributes should be rendered in block form.
48 49 50 |
# File 'lib/sevgi/graphics/mixtures/render.rb', line 48 def attributes_as_block?(lines, depth) linelength(lines, depth) > [:linelength] end |
#linelength(lines, depth) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the effective inline line length.
56 57 58 |
# File 'lib/sevgi/graphics/mixtures/render.rb', line 56 def linelength(lines, depth) indent(depth).length + lines.sum(&:length) end |