Class: Fabulator::Expr::UnionExpr

Inherits:
Object
  • Object
show all
Defined in:
lib/fabulator/expr/union_expr.rb

Instance Method Summary collapse

Constructor Details

#initialize(es) ⇒ UnionExpr

Returns a new instance of UnionExpr.



4
5
6
# File 'lib/fabulator/expr/union_expr.rb', line 4

def initialize(es)
  @exprs = es
end

Instance Method Details

#expr_type(context) ⇒ Object



8
9
10
# File 'lib/fabulator/expr/union_expr.rb', line 8

def expr_type(context)
  Fabulator::TagLib.unify_types(@exprs.collect{ |e| e.expr_type(context) })
end

#run(context, autovivify = false) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/fabulator/expr/union_expr.rb', line 12

def run(context, autovivify = false)
  u = [ ]
  @exprs.each do |e|
    u = u + e.run(context, autovivify)
  end
  return u.uniq
end