Sha256: 2f63de4e5fdebff6601d8354eb43ed7c47d606b3dd5b9804b92125c305199584

Contents?: true

Size: 800 Bytes

Versions: 13

Compression:

Stored size: 800 Bytes

Contents

class Remailer::Interpreter::StateProxy
  STATIC_CLASSES = [ String, Fixnum, NilClass, TrueClass, FalseClass, Float ].freeze
  
  def initialize(options, &block)
    @options = options
    
    instance_eval(&block) if (block_given?)
  end
  
  def parse(spec = nil, &block)
    @options[:parser] = Remailer::Interpreter.parse(spec, &block)
  end
  
  def enter(&block)
    (@options[:enter] ||= [ ]) << block
  end
  
  def interpret(response, &block)
    (@options[:interpret] ||= [ ]) << [ response, block ]
  end
  
  def default(&block)
    (@options[:default] ||= [ ]) << block
  end

  def leave(&block)
    (@options[:leave] ||= [ ]) << block
  end
  
  def terminate(&block)
    (@options[:terminate] ||= [ ]) << block
  end

protected
  def rebind(options)
    @options = options
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
remailer-0.4.21 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.20 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.19 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.18 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.17 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.16 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.15 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.14 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.13 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.12 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.11 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.10 lib/remailer/interpreter/state_proxy.rb
remailer-0.4.8 lib/remailer/interpreter/state_proxy.rb