Class: MCMarkdown::Parser::ShortTag::Tag
- Inherits:
-
Object
- Object
- MCMarkdown::Parser::ShortTag::Tag
- Defined in:
- lib/mc_markdown/parsers/short_tag.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#orig ⇒ Object
readonly
Returns the value of attribute orig.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(matched_string) ⇒ Tag
constructor
A new instance of Tag.
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
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
29 30 31 |
# File 'lib/mc_markdown/parsers/short_tag.rb', line 29 def attributes @attributes end |
#orig ⇒ Object (readonly)
Returns the value of attribute orig.
27 28 29 |
# File 'lib/mc_markdown/parsers/short_tag.rb', line 27 def orig @orig end |
#type ⇒ Object (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
.pattern ⇒ Object
23 24 25 |
# File 'lib/mc_markdown/parsers/short_tag.rb', line 23 def self.pattern /\{\{ (.*?) \}\}/x end |