Class: WikiMd::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/wiki_md.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rx, debug: false) ⇒ Entry

Returns a new instance of Entry.



22
23
24
25
26
27
28
# File 'lib/wiki_md.rb', line 22

def initialize(rx, debug: false)
  
  @rx, @debug = rx, debug
  @x = @rx.x
  parse_x()
  
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



20
21
22
# File 'lib/wiki_md.rb', line 20

def body
  @body
end

Returns the value of attribute footer.



20
21
22
# File 'lib/wiki_md.rb', line 20

def footer
  @footer
end

#headingObject (readonly)

Returns the value of attribute heading.



20
21
22
# File 'lib/wiki_md.rb', line 20

def heading
  @heading
end

#tagsObject (readonly)

Returns the value of attribute tags.



20
21
22
# File 'lib/wiki_md.rb', line 20

def tags
  @tags
end

#xObject

Returns the value of attribute x.



20
21
22
# File 'lib/wiki_md.rb', line 20

def x
  @x
end

Instance Method Details

#idObject



41
42
43
# File 'lib/wiki_md.rb', line 41

def id()
  @rx.id
end

#to_s(compact: false) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/wiki_md.rb', line 50

def to_s(compact: false)
  
  if !compact then
    
    @x.clone + "\n\n"
    
  else
    '# ' + @heading + ' #' + @tags.join(' #') + "\n\n" + @body
  end

end