Class: Murdoc::Paragraph
- Inherits:
-
Object
- Object
- Murdoc::Paragraph
- Defined in:
- lib/murdoc/paragraph.rb
Instance Attribute Summary collapse
-
#annotation ⇒ Object
Returns the value of attribute annotation.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_type ⇒ Object
Returns the value of attribute source_type.
-
#starting_line ⇒ Object
Returns the value of attribute starting_line.
Instance Method Summary collapse
- #extract_metadata! ⇒ Object
-
#initialize(source, annotation, starting_line = 0, source_type = nil) ⇒ Paragraph
constructor
A new instance of Paragraph.
Constructor Details
#initialize(source, annotation, starting_line = 0, source_type = nil) ⇒ Paragraph
Returns a new instance of Paragraph.
19 20 21 22 23 24 25 |
# File 'lib/murdoc/paragraph.rb', line 19 def initialize(source, annotation, starting_line = 0, source_type = nil) self.source = source self.annotation = annotation self.starting_line = starting_line self.source_type = source_type end |
Instance Attribute Details
#annotation ⇒ Object
Returns the value of attribute annotation.
14 15 16 |
# File 'lib/murdoc/paragraph.rb', line 14 def annotation @annotation end |
#metadata ⇒ Object
Returns the value of attribute metadata.
17 18 19 |
# File 'lib/murdoc/paragraph.rb', line 17 def @metadata end |
#source ⇒ Object
Returns the value of attribute source.
13 14 15 |
# File 'lib/murdoc/paragraph.rb', line 13 def source @source end |
#source_type ⇒ Object
Returns the value of attribute source_type.
15 16 17 |
# File 'lib/murdoc/paragraph.rb', line 15 def source_type @source_type end |
#starting_line ⇒ Object
Returns the value of attribute starting_line.
16 17 18 |
# File 'lib/murdoc/paragraph.rb', line 16 def starting_line @starting_line end |
Instance Method Details
#extract_metadata! ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/murdoc/paragraph.rb', line 27 def if annotation =~ /(.*\n)?^---!([^\n]*)\n?(.*)\z/m self. = Murdoc.try_load_yaml($2) self.annotation = $1.to_s + $3.to_s else self. = {} end end |