class Korekto::Syntax

Public Class Methods

new(= @a=[]) click to toggle source
# File lib/korekto/syntax.rb, line 3
  def initialize = @a=[]
  def each = @a.each{|s| yield s}

  def push(s)
    # ensure it'll eval on string and returns boolean
    b = ''.instance_eval(s)
    raise Error, 'syntax rule must eval boolean' unless b==!!b
    @a.push(s)
  rescue
    raise Error, "#{$!.class}: #{s}"
  end
end
end

Public Instance Methods

each(= @a.each{|s| yield s}) click to toggle source
# File lib/korekto/syntax.rb, line 4
  def each = @a.each{|s| yield s}

  def push(s)
    # ensure it'll eval on string and returns boolean
    b = ''.instance_eval(s)
    raise Error, 'syntax rule must eval boolean' unless b==!!b
    @a.push(s)
  rescue
    raise Error, "#{$!.class}: #{s}"
  end
end
push(s) click to toggle source
# File lib/korekto/syntax.rb, line 6
def push(s)
  # ensure it'll eval on string and returns boolean
  b = ''.instance_eval(s)
  raise Error, 'syntax rule must eval boolean' unless b==!!b
  @a.push(s)
rescue
  raise Error, "#{$!.class}: #{s}"
end