class Pione::Lang::Expr

Expr is a base class for all PIONE expressions.

Public Class Methods

inherited(subclass) click to toggle source
# File lib/pione/lang/expr.rb, line 19
def inherited(subclass)
  if @pione_type
    subclass.set_pione_type(@pione_type)
  end
end
pione_type(env=nil) click to toggle source

Set pione model type of the model.

# File lib/pione/lang/expr.rb, line 10
def pione_type(env=nil)
  @pione_type
end
set_pione_type(type) click to toggle source
# File lib/pione/lang/expr.rb, line 14
def set_pione_type(type)
  @pione_type = type
  Type.table[type.name][:sequence_class] = self
end

Public Instance Methods

eval(env) click to toggle source
# File lib/pione/lang/expr.rb, line 28
def eval(env)
  return self
end
eval!(env) click to toggle source
# File lib/pione/lang/expr.rb, line 32
def eval!(env)
  return self
end
textize() click to toggle source

Convert to text string.

# File lib/pione/lang/expr.rb, line 37
def textize
  args = to_h.map do |key, val|
    "%s: %s" % [key, val.kind_of?(Piece) ? val.textize : val.to_s]
  end.join(", ")
  "#%s{%s}" % [piece_classes.first.piece_type_name, args]
end
to_s() click to toggle source
# File lib/pione/lang/expr.rb, line 44
def to_s
  textize
end