class Organismo::Element::Header
Attributes
level[R]
location[R]
raw_text[R]
Public Class Methods
new(text, location)
click to toggle source
# File lib/organismo/element/header.rb, line 5 def initialize(text, location) @raw_text = raw_text_without_tag(text) @level = header_level(text) @location = location end
Public Instance Methods
convert_to_html()
click to toggle source
# File lib/organismo/element/header.rb, line 11 def convert_to_html "<h#{level}>#{raw_text}</h#{level}>" end
Private Instance Methods
header_level(text)
click to toggle source
# File lib/organismo/element/header.rb, line 21 def header_level(text) split_text(text).first.lstrip.rstrip.size + 1 end
raw_text_without_tag(text)
click to toggle source
# File lib/organismo/element/header.rb, line 17 def raw_text_without_tag(text) split_text(text).last.lstrip.rstrip end
split_text(text)
click to toggle source
# File lib/organismo/element/header.rb, line 25 def split_text(text) text.split(/\* /) end