Class: MCMarkdown::Parser::ShortTag::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/mc_markdown/parsers/short_tag.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matched_string) ⇒ Tag

Returns a new instance of Tag.



31
32
33
34
35
36
37
38
39
# 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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



29
30
31
# File 'lib/mc_markdown/parsers/short_tag.rb', line 29

def attributes
  @attributes
end

#origObject (readonly)

Returns the value of attribute orig.



27
28
29
# File 'lib/mc_markdown/parsers/short_tag.rb', line 27

def orig
  @orig
end

#typeObject (readonly)

Returns the value of attribute type.



28
29
30
# File 'lib/mc_markdown/parsers/short_tag.rb', line 28

def type
  @type
end

Class Method Details

.patternObject



23
24
25
# File 'lib/mc_markdown/parsers/short_tag.rb', line 23

def self.pattern
  /\{\{ (.*?) \}\}/x
end