class Slight::Configuration

Public Class Methods

new(options = {}, &blk) click to toggle source
# File lib/slight/config.rb, line 3
def initialize(options = {}, &blk)
  @options = options
  @options[:cus] ||= {}
  @options[:shortcutA] ||= {}
  @options[:shortcutT] ||= {}
  @options[:blinding] ||= {}
  @options[:before_filter] ||= []
  @options[:after_filter] ||= []
  blk.call self
  @options
end

Public Instance Methods

blinding(*system_fun) click to toggle source
# File lib/slight/config.rb, line 35
def blinding(*system_fun)
  @options[:blinding] = system_fun.map(&:to_sym)
end
get(k) click to toggle source
# File lib/slight/config.rb, line 16
def get(k); @options[:cus][k]; end
set(k, v) click to toggle source
# File lib/slight/config.rb, line 15
def set(k, v); @options[:cus][k] = v; end
setIO(io_out) click to toggle source
# File lib/slight/config.rb, line 17
def setIO(io_out);  @options[:io_out] = io_out; end
shortcut(type, pattern, replacement) click to toggle source
# File lib/slight/config.rb, line 26
def shortcut(type, pattern, replacement)
  case(type)
  when :A
    @options[:shortcutA][pattern.to_sym] = replacement
  when :T
    @options[:shortcutT][pattern.to_sym] = replacement
  end
end
use(t, flag = :before) click to toggle source
# File lib/slight/config.rb, line 18
def use(t, flag = :before)
  if flag == :before then
    @options[:before_filter].push(t)
  else
    @options[:after_filter].push(t)
  end
end