Module: Sevgi::Graphics::Mixtures::Render::Renderer::Attributes::Hybrid

Defined in:
lib/sevgi/graphics/mixtures/render.rb

Instance Method Summary collapse

Instance Method Details

#attributes(element, depth) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/sevgi/graphics/mixtures/render.rb', line 18

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

Returns:

  • (Boolean)


26
27
28
# File 'lib/sevgi/graphics/mixtures/render.rb', line 26

def attributes_as_block?(lines, depth)
  linelength(lines, depth) > options[:linelength]
end

#linelength(lines, depth) ⇒ Object



30
31
32
# File 'lib/sevgi/graphics/mixtures/render.rb', line 30

def linelength(lines, depth)
  indent(depth).length + lines.sum(&:length)
end