Class: Oso::Polar::Data::Filter::Condition

Inherits:
Struct
  • Object
show all
Defined in:
lib/oso/polar/data/filter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#cmpObject

Returns the value of attribute cmp

Returns:

  • (Object)

    the current value of cmp



38
39
40
# File 'lib/oso/polar/data/filter.rb', line 38

def cmp
  @cmp
end

#leftObject

Returns the value of attribute left

Returns:

  • (Object)

    the current value of left



38
39
40
# File 'lib/oso/polar/data/filter.rb', line 38

def left
  @left
end

#rightObject

Returns the value of attribute right

Returns:

  • (Object)

    the current value of right



38
39
40
# File 'lib/oso/polar/data/filter.rb', line 38

def right
  @right
end

Class Method Details

.parse(polar, left, cmp, right) ⇒ Object



39
40
41
# File 'lib/oso/polar/data/filter.rb', line 39

def self.parse(polar, left, cmp, right)
  Condition.new(parse_side(polar, left), cmp, parse_side(polar, right))
end

.parse_side(polar, side) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/oso/polar/data/filter.rb', line 43

def self.parse_side(polar, side)
  key = side.keys.first
  val = side[key]
  case key
  when 'Field'
    Projection.new(polar.name_to_class(val[0]), val[1])
  when 'Immediate'
    polar.host.to_ruby('value' => [[val.keys.first, val.values.first]])
  else
    raise key
  end
end