Class: Pione::Lang::Expr
- Inherits:
-
StructX
- Object
- StructX
- Pione::Lang::Expr
- Includes:
- Util::Positionable
- Defined in:
- lib/pione/lang/expr.rb
Overview
Expr is a base class for all PIONE expressions.
Class Method Summary collapse
- .inherited(subclass) ⇒ Object
-
.pione_type(env = nil) ⇒ Object
Set pione model type of the model.
- .set_pione_type(type) ⇒ Object
Instance Method Summary collapse
- #eval(env) ⇒ Object
- #eval!(env) ⇒ Object
-
#textize ⇒ Object
Convert to text string.
- #to_s ⇒ Object
Methods included from Util::Positionable
#line_and_column, #pos, #set_source_position
Class Method Details
.inherited(subclass) ⇒ Object
19 20 21 22 23 |
# 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) ⇒ Object
Set pione model type of the model.
10 11 12 |
# File 'lib/pione/lang/expr.rb', line 10 def pione_type(env=nil) @pione_type end |
Instance Method Details
#eval(env) ⇒ Object
28 29 30 |
# File 'lib/pione/lang/expr.rb', line 28 def eval(env) return self end |
#eval!(env) ⇒ Object
32 33 34 |
# File 'lib/pione/lang/expr.rb', line 32 def eval!(env) return self end |
#textize ⇒ Object
Convert to text string.
37 38 39 40 41 42 |
# 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 ⇒ Object
44 45 46 |
# File 'lib/pione/lang/expr.rb', line 44 def to_s textize end |