class Pione::Lang::Piece

Piece is a base class for all elements of sequence. You cannot write it directly in PIONE language because pieces are not included in expressions.

Public Class Methods

piece_type_name(name=nil) click to toggle source

Declare the type name of piece.

# File lib/pione/lang/piece.rb, line 10
def self.piece_type_name(name=nil)
  name ? @piece_type_name = name : @piece_type_name
end

Public Instance Methods

eval(env) click to toggle source
# File lib/pione/lang/piece.rb, line 16
def eval(env)
  return self
end
textize() click to toggle source

Convert to text string.

# File lib/pione/lang/piece.rb, line 21
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_type_name, args]
end