class Rudelo::Parsers::SetLogicTransform

Constants

CardinalityExpr
MatchExpr
SetConstructionExpr
SetLogicExpr
SetOp

Attributes

in_set[RW]
set_value[RW]

Public Class Methods

new(in_set=::Set.new, &block) click to toggle source
Calls superclass method
# File lib/rudelo/parsers/set_logic_transform.rb, line 17
def initialize(in_set=::Set.new, &block)
  @in_set = in_set.dup # the dup is vital because we are going to be pointery later
  @set_value = SetValueTransform.new
  super()
end
translate_op(op) click to toggle source
# File lib/rudelo/parsers/set_logic_transform.rb, line 89
def self.translate_op(op)
  case op
  when '#=', 'cardinality-equals',
    'same-as', '=';                      :"=="
  when '#<','cardinality-less-than';     :<
  when '<','proper-subset';              :proper_subset?
  when '#>','cardinality-greater-than';  :>
  when '>', 'proper-superset';           :proper_superset?
  when '<=', 'subset';                   :subset?
  when '>=', 'superset';                 :superset?
  when 'intersection';                   :&
  when 'union';                          :+
  when 'difference';                     :-
  when 'exclusive';                      :'^'
  else
    op.to_sym
  end
end

Public Instance Methods

apply(obj, context=nil) click to toggle source
Calls superclass method
# File lib/rudelo/parsers/set_logic_transform.rb, line 23
def apply(obj, context=nil)
  super @set_value.apply(obj, context), {in_set: @in_set}
end