class Murdoc::Paragraph

Attributes

annotation[RW]
metadata[RW]
source[RW]
source_type[RW]
starting_line[RW]

Public Class Methods

new(source, annotation, starting_line = 0, source_type = nil) click to toggle source
# 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
  extract_metadata!
end

Public Instance Methods

extract_metadata!() click to toggle source
# File lib/murdoc/paragraph.rb, line 27
def extract_metadata!
  if annotation =~ /(.*\n)?^---!([^\n]*)\n?(.*)\z/m
    self.metadata = Murdoc.try_load_yaml($2)
    self.annotation = $1.to_s + $3.to_s
  else
    self.metadata = {}
  end
end