Class: Mech::Compiler::Format

Inherits:
Object
  • Object
show all
Includes:
Mech::Configurator
Defined in:
lib/mech.rb,
lib/mech/compiler/format.rb

Direct Known Subclasses

ActionScript, Cl, JavaScript, Ruby, Scala, Yaml

Defined Under Namespace

Classes: ActionScript, Cl, JavaScript, Ruby, Scala, Yaml

Instance Method Summary collapse

Methods included from Mech::Configurator

#config, #init

Constructor Details

#initialize(*args) ⇒ Format

Returns a new instance of Format.



11
12
13
# File 'lib/mech/compiler/format.rb', line 11

def initialize(*args)
  @data = {}
end

Instance Method Details

#compile(data, params = {}, &block) ⇒ Object



7
8
9
# File 'lib/mech/compiler/format.rb', line 7

def compile(data, params = {}, &block)
  raise 'Compile method not exist'
end

#outputObject



23
24
25
# File 'lib/mech/compiler/format.rb', line 23

def output
  @data
end

#tmp_pathObject



19
20
21
# File 'lib/mech/compiler/format.rb', line 19

def tmp_path
  raise 'Not defined tmp path'
end

#with_templateObject



15
16
17
# File 'lib/mech/compiler/format.rb', line 15

def with_template
  ERB.new(File.read(tmp_path)).result(binding)
end