class Python::Syntax::Statement

Public Class Methods

new(*args) click to toggle source
# File lib/python/syntax.rb, line 15
def initialize(*args)
  min_argc = attrs.take_while{|attr| attr.is_a?(Symbol)}.count
  max_argc = attrs.flatten.count
  unless min_argc <= args.length && args.length <= max_argc
    raise "Argument error: failed to make instance of #{self.class.name}." +
          "expected: #{attrs}, actual: #{args}"
  end
  attrs.flatten.zip(args).each do |name, val|
    instance_variable_set("@#{name}".to_sym, val)
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/python/syntax.rb, line 31
def ==(other)
  self.class == other.class && attrs.flatten.all? do |vname|
    ivname = "@#{vname}".to_sym
    self.instance_variable_get(ivname) == other.instance_variable_get(ivname)
  end
end
attrs() click to toggle source
# File lib/python/syntax.rb, line 7
def attrs
  []
end
eval(env) click to toggle source
# File lib/python/syntax.rb, line 27
def eval(env)
  instance_exec(env, &eval_proc)
end
eval_proc() click to toggle source
# File lib/python/syntax.rb, line 11
def eval_proc
  proc{}
end