Class: Malt::Format::Text
Overview
Plain text format. Plain text documents are uniqu in that they can be transformed into any other type of document. For example, applying to_html in text doesn’t actually transform the source text in any way. Rather it simply “informs” Malt to treat the text as HTML.
Instance Attribute Summary
Attributes inherited from Abstract
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_default, #to_s, #type
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/malt/formats/text.rb', line 27 def method_missing(sym, *args, &block) if md = /^to_/.match(sym.to_s) type = md.post_match.to_sym opts = .merge(:type=>type, :file=>refile(type)) return Malt.text(text, opts) end super(sym, *args, &block) end |
Instance Method Details
#to_txt ⇒ Object
22 23 24 |
# File 'lib/malt/formats/text.rb', line 22 def to_txt(*) self end |
#txt ⇒ Object
17 18 19 |
# File 'lib/malt/formats/text.rb', line 17 def txt(*) text end |