class Pione::Lang::CompoundFeature
CompoundFeature
represents conjunction of feature pieces.
Public Class Methods
build(piece1, piece2)
click to toggle source
# File lib/pione/lang/feature-expr.rb, line 129 def build(piece1, piece2) # unify features if they are same return piece1 if piece1 == piece2 # append if either feature is compound return piece1.add(piece2) if piece1.is_a?(CompoundFeature) return piece2.add(piece1) if piece2.is_a?(CompoundFeature) # create new compound feature new(pieces: Set.new([piece1, piece2])) end
Public Instance Methods
add(piece)
click to toggle source
# File lib/pione/lang/feature-expr.rb, line 144 def add(piece) if piece.is_a?(CompoundFeature) set(pieces: pieces + piece.pieces) else set(pieces: pieces + Set.new([piece])) end end