Class: Malt::Formats::YAML

Inherits:
Abstract show all
Defined in:
lib/malt/formats/yaml.rb

Overview

YAML format

TODO: hmm… maybe use data to update yaml?

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Abstract

#default, engine, #engine, #extensions, extensions, #file, #parse_type_and_data, #refile, register, #render, #subtype, #text, #to, #to_s, #type

Instance Method Details

#htmlObject

Converting a plan YAML file to HTML makes no sense so we just wrap it in pre tags.



29
30
31
# File 'lib/malt/formats/yaml.rb', line 29

def html
  "<pre>\n#{h text}\n</pre>"
end

#to_htmlObject



34
35
36
37
38
# File 'lib/malt/formats/yaml.rb', line 34

def to_html
  text = html
  opts = options.merge(:text=>text, :file=>refile(:html), :type=>:html)
  HTML.new(opts)
end

#to_yamlObject Also known as: to_yml



21
22
23
# File 'lib/malt/formats/yaml.rb', line 21

def to_yaml(*)
  self
end

#yamlObject Also known as: yml



14
15
16
# File 'lib/malt/formats/yaml.rb', line 14

def yaml(*)
  text
end