class MCMarkdown::Parser::ShortTag::Tag

Attributes

attributes[R]
orig[R]
type[R]

Public Class Methods

new(matched_string) click to toggle source
# File lib/mc_markdown/parsers/short_tag.rb, line 31
def initialize matched_string
  @orig = matched_string
  @data = @orig.match( Tag.pattern )[1].strip.split(' ')
  @type = @data.shift
  @attributes = @data.map { |set| set.scan( attribute_pattern ) }.inject({}) do |out,pair|
    out[ pair[0][0].to_sym ] = pair[0][1]
    out
  end
end
pattern() click to toggle source
# File lib/mc_markdown/parsers/short_tag.rb, line 23
def self.pattern
  /\{\{ (.*?) \}\}/x
end

Private Instance Methods

attribute_pattern() click to toggle source
# File lib/mc_markdown/parsers/short_tag.rb, line 43
def attribute_pattern
  / (\w+) = ['"](.+?)['"] /x
end