Class: Pione::Lang::ParameterSetSequence

Inherits:
OrdinalSequence show all
Defined in:
lib/pione/lang/parameters.rb

Instance Method Summary collapse

Methods inherited from OrdinalSequence

#empty, #fold, fold, #fold2, fold2, #inspect, make_piece, #map, map, map2, #map2, map3, #map3, #map_by, of

Methods inherited from Sequence

#assertive?, #attribute, #concat, #eval, index_type, inherited, piece_class, piece_classes, #push, #set_annotation_type, set_index_type, #update_pieces, void, #void?

Methods included from Callable

#call_pione_method

Methods included from Util::Positionable

#line_and_column, #pos, #set_source_position

Methods inherited from Expr

#eval, #eval!, inherited, pione_type, set_pione_type, #textize, #to_s

Instance Method Details

#eachObject



95
96
97
98
99
100
101
# File 'lib/pione/lang/parameters.rb', line 95

def each
  if block_given?
    pieces.each {|piece| piece.each {|pset| yield set(pieces: [pset])}}
  else
    Enumerator.new(self, :each)
  end
end

#merge(other) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/pione/lang/parameters.rb', line 103

def merge(other)
  if pieces.empty?
    set(pieces: other.pieces)
  else
    map2(other) do |rec_piece, other_piece|
      rec_piece.set(table: rec_piece.table.merge(other_piece.table))
    end
  end
end