Class: MaRuKu::In::Markdown::SpanLevelParser::SpanContext

### Home Classes Methods

### In Files

- lib/maruku/input/parse_span.rb

### Parent

Object

### Methods

- ::new
- #describe
- #is_end?
- #push
- #push_char
- #push_element
- #push_elements
- #push_space
- #push_string_if_present

### Class/Module Index

Quicksearch

- MaRuKu
- MaRuKu::AttributeList
- MaRuKu::Errors
- MaRuKu::Exception
- MaRuKu::HTMLElement
- MaRuKu::HTMLFragment
- MaRuKu::Helpers
- MaRuKu::In
- MaRuKu::In::Markdown
- MaRuKu::In::Markdown::BlockLevelParser
- MaRuKu::In::Markdown::BlockLevelParser::BlockContext
- MaRuKu::In::Markdown::BlockLevelParser::LineSource
- MaRuKu::In::Markdown::SpanExtension
- MaRuKu::In::Markdown::SpanLevelParser
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceDebug
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceManual
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceStrscan
- MaRuKu::In::Markdown::SpanLevelParser::HTMLHelper
- MaRuKu::In::Markdown::SpanLevelParser::SpanContext
- MaRuKu::MDDocument
- MaRuKu::MDElement
- MaRuKu::MDHTMLElement
- MaRuKu::MDLine
- MaRuKu::NokogiriHTMLFragment
- MaRuKu::Out
- MaRuKu::Out::EntityTable
- MaRuKu::Out::HTML
- MaRuKu::Out::HTML::HTMLElement
- MaRuKu::Out::Latex
- MaRuKu::Out::Latex::MDDocumentExtensions
- MaRuKu::Out::Markdown
- MaRuKu::REXMLHTMLFragment
- MaRuKu::Section
- MaRuKu::Strings
- Maruku
- Maruku::In
- Maruku::In::Markdown
- Maruku::In::Markdown::FencedCode
- Object
- String
- Textile2Signature

No matching classes.

# 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(e) click to toggle source
Alias for: push_element
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

[Validate]

Generated with the Darkfish Rdoc Generator 2.