Parent

Color::RGB::JP::Compiler::Compiler

Attributes

encoding[RW]
generator[RW]
pallet[RW]
prefix[RW]
preprocessor[RW]
trim_mode[RW]

Public Class Methods

new(pallet, encoding, prefix, generator) click to toggle source
# File lib/color/rgb/jp/compiler/compiler.rb, line 21
def initialize(pallet, encoding, prefix, generator)
  @pallet = pallet
  @encoding = encoding
  @prefix = prefix
  @generator = generator
  @preprocessor = DEFAULT_PREPROCESSOR
  @trim_mode = DEFAULT_TRIM_MODE
end

Public Instance Methods

compile(src, input) click to toggle source
# File lib/color/rgb/jp/compiler/compiler.rb, line 47
def compile(src, input)
  e = ERB.new(src, 0, @trim_mode)
  e.filename = input if String === input
  e.result
end
execute(input, output, do_compile) click to toggle source
# File lib/color/rgb/jp/compiler/compiler.rb, line 30
def execute(input, output, do_compile)
  with_input_stream(input) do |is|
    erbscript = preprocess(is.read, input)
    with_output_stream(output) do |os|
      if do_compile
        os.write compile(erbscript, input)
      else
        os.write erbscript
      end
    end
  end
end
preprocess(src, input) click to toggle source
# File lib/color/rgb/jp/compiler/compiler.rb, line 43
def preprocess(src, input)
  preprocess_snippet(prefix) + do_preprocess(src, @prefix)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.