Class: Rudelo::Parsers::SetLogicTransform::MatchExpr
- Inherits:
-
Struct
- Object
- Struct
- Rudelo::Parsers::SetLogicTransform::MatchExpr
- Defined in:
- lib/rudelo/parsers/set_logic_transform.rb
Instance Attribute Summary collapse
-
#in_set ⇒ Object
Returns the value of attribute in_set.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
Instance Method Summary collapse
Instance Attribute Details
#in_set ⇒ Object
Returns the value of attribute in_set
66 67 68 |
# File 'lib/rudelo/parsers/set_logic_transform.rb', line 66 def in_set @in_set end |
#left ⇒ Object
Returns the value of attribute left
66 67 68 |
# File 'lib/rudelo/parsers/set_logic_transform.rb', line 66 def left @left end |
#right ⇒ Object
Returns the value of attribute right
66 67 68 |
# File 'lib/rudelo/parsers/set_logic_transform.rb', line 66 def right @right end |
Instance Method Details
#eval(in_set_override = nil) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/rudelo/parsers/set_logic_transform.rb', line 67 def eval(in_set_override=nil) # I've always wondered what these replace methods were for # and now I know. To make references more pointery. # The purpose of this is so we can construct a transform # once and use it with different values for in_set. in_set.replace(in_set_override) unless in_set_override.nil? lvalue = left.eval case lvalue when ::Set right.empty? ? (lvalue.size > 0) : right.eval(lvalue) when ::TrueClass, ::FalseClass lvalue && right.eval(left.set) else nil end end |