Class: Minidown::LineElement

Inherits:
Element
  • Object
show all
Defined in:
lib/minidown/elements/line_element.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#children, #content, #doc, #nodes

Instance Method Summary collapse

Methods inherited from Element

#raw_content, #raw_content=, #unparsed_lines

Methods included from HtmlHelper

#br_tag, #build_tag

Constructor Details

#initialize(doc, content = nil) ⇒ LineElement

Returns a new instance of LineElement.



5
6
7
8
# File 'lib/minidown/elements/line_element.rb', line 5

def initialize doc, content=nil
  super
  @display = true
end

Instance Attribute Details

#displayObject

Returns the value of attribute display.



3
4
5
# File 'lib/minidown/elements/line_element.rb', line 3

def display
  @display
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/minidown/elements/line_element.rb', line 10

def blank?
  true
end

#parseObject



14
15
16
17
18
# File 'lib/minidown/elements/line_element.rb', line 14

def parse
  node = nodes.last
  @display = (doc.within_block || TextElement === node)
  nodes << self
end

#to_htmlObject



20
21
22
23
24
25
26
# File 'lib/minidown/elements/line_element.rb', line 20

def to_html
  if @display
    br_tag
  else
    ''
  end
end