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

### Home Classes Methods

### In Files

- lib/color/rgb/jp/compiler/compiler.rb

### Parent

Object

### Methods

- ::new
- #compile
- #execute
- #preprocess

### Class/Module Index

Quicksearch

- Color
- Color::RGB
- Color::RGB::JP
- Color::RGB::JP::Base
- Color::RGB::JP::Base::ColorName
- Color::RGB::JP::Base::Encode
- Color::RGB::JP::Base::NamedRGB
- Color::RGB::JP::Base::Pallet
- Color::RGB::JP::Compiler
- Color::RGB::JP::Compiler::Command
- Color::RGB::JP::Compiler::Compiler
- Color::RGB::JP::VERSION

No matching classes.

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

### Constants

COLOR_NAME_CHAR
COLOR_NAME_RE
DEFAULT_PREPROCESSOR
DEFAULT_TRIM_MODE

### 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.