Class: NoraMark::Frontmatter

Inherits:
Node
  • Object
show all
Defined in:
lib/nora_mark/node.rb,
lib/nora_mark/parser.kpeg.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#attrs, #body_empty, #classes, #first_child, #holders, #ids, #last_child, #name, #next, #no_tag, #parent, #prev, #raw_content, #raw_text

Instance Method Summary collapse

Methods inherited from Node

#_find_node, #_match?, #_remove_internal, #add_attr, #after, #all_nodes, #ancestors, #append_child, #before, #build_selector, #children, #children=, #children_empty?, #children_replaced, #clone, #each, #find_node, #match?, #modify_selector, #named_params, #named_params=, #params, #params=, #prepend_child, #raw_text?, #rebuild_children, #remove, #remove_following, #replace, #unlink, #wrap

Constructor Details

#initialize(content, line_no) ⇒ Frontmatter

Returns a new instance of Frontmatter.



86
87
88
89
# File 'lib/nora_mark/parser.kpeg.rb', line 86

def initialize(content, line_no)
  @content = content
  @line_no = line_no
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



90
91
92
# File 'lib/nora_mark/parser.kpeg.rb', line 90

def content
  @content
end

#line_noObject (readonly)

Returns the value of attribute line_no.



91
92
93
# File 'lib/nora_mark/parser.kpeg.rb', line 91

def line_no
  @line_no
end

Instance Method Details

#reparentObject



413
414
415
# File 'lib/nora_mark/node.rb', line 413

def reparent
  # do nothing
end

#textObject



417
418
419
# File 'lib/nora_mark/node.rb', line 417

def text
  @content.join "\n"
end

#yamlObject



421
422
423
424
# File 'lib/nora_mark/node.rb', line 421

def yaml
  @yaml ||= YAML.load(@content.join("\n"))
  @yaml
end