Class: Humanized::CompilerBase

Inherits:
Object
  • Object
show all
Defined in:
lib/humanized/compiler.rb

Direct Known Subclasses

Compiler, RubyCompiler

Instance Method Summary collapse

Constructor Details

#initializeCompilerBase

Returns a new instance of CompilerBase.



38
39
40
# File 'lib/humanized/compiler.rb', line 38

def initialize
  @compiled = Hash.new{|hsh,x| hsh[x] = compile!(x)}
end

Instance Method Details

#compile(str) ⇒ Compiled

Compiles a String into a Proc

Parameters:

  • str (String)

    A formated String

Returns:

  • (Compiled)

    A Proc, which will handle interpolation.



47
48
49
# File 'lib/humanized/compiler.rb', line 47

def compile(str)
  @compiled[str]
end