Class: Malt::Format::Ruby

Inherits:
AbstractTemplate show all
Defined in:
lib/malt/formats/ruby.rb

Overview

Yes, pure Ruby as a template format.

The ruby code is run through eval and whatever it returns is given as the rendering.

The Ruby format is a polyglot format –it accepts all conversion types and assumes the end-user knows it will be the result.

In the future, the Ruby type might also used for “precompiling” other formats such as ERB.

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from AbstractTemplate

#method_missing, #render, #to

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!

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Malt::Format::AbstractTemplate

Instance Method Details

#rbObject Also known as: ruby



22
23
24
# File 'lib/malt/formats/ruby.rb', line 22

def rb(*)
  text
end

#to_rbObject Also known as: to_ruby



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

def to_rb(*)
  self
end