class MaRuKu::In::Markdown::SpanLevelParser::SpanContext
Attributes
elements[RW]
Read elements
Public Class Methods
new()
click to toggle source
# File lib/maruku/input/parse_span.rb, line 685 def initialize @elements = [] @cur_string = '' end
Public Instance Methods
describe()
click to toggle source
# File lib/maruku/input/parse_span.rb, line 731 def describe lines = @elements.map{|x| x.inspect }.join("\n") s = "Elements read in span: \n" + lines.gsub(/^/, ' -') + "\n" s += "Current string: \n #{@cur_string.inspect}\n" unless @cur_string.empty? s end
is_end?()
click to toggle source
# File lib/maruku/input/parse_span.rb, line 710 def is_end? @cur_string.empty? || @cur_string =~ /\s\z/ end
push_char(c)
click to toggle source
# File lib/maruku/input/parse_span.rb, line 721 def push_char(c) @cur_string << c end
push_element(e)
click to toggle source
# File lib/maruku/input/parse_span.rb, line 690 def push_element(e) raise "Only MDElement and String, please. You pushed #{e.class}: #{e.inspect} " unless e.kind_of?(String) || e.kind_of?(MaRuKu::MDElement) push_string_if_present @elements << e end
Also aliased as: push
push_elements(a)
click to toggle source
# File lib/maruku/input/parse_span.rb, line 700 def push_elements(a) a.each do |e| if e.kind_of? String @cur_string << e else push_element e end end end
push_space()
click to toggle source
push space into current string if there isn't one
# File lib/maruku/input/parse_span.rb, line 727 def push_space @cur_string << ' ' unless @cur_string[-1, 1] == ' ' end
push_string_if_present()
click to toggle source
# File lib/maruku/input/parse_span.rb, line 714 def push_string_if_present unless @cur_string.empty? @elements << @cur_string @cur_string = '' end end