Class: Malt::Format::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, file_extension, #file_read, #file_type, #parse_type_from_data, #refile, register, #render, #render_into, #rendering_parameters, #scope_vs_data, #subtype, #text, #to, #to_default, #to_s, #type, #with, #with!

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