Class: Payload::ARMFilter
- Inherits:
-
Object
- Object
- Payload::ARMFilter
- Defined in:
- lib/payload/arm/attr.rb
Direct Known Subclasses
ARMContains, ARMEqual, ARMGreaterThan, ARMGreaterThanEqual, ARMLessThan, ARMLessThanEqual, ARMNotEqual
Instance Attribute Summary collapse
-
#attr ⇒ Object
readonly
Returns the value of attribute attr.
-
#opval ⇒ Object
readonly
Returns the value of attribute opval.
-
#val ⇒ Object
readonly
Returns the value of attribute val.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attr, val) ⇒ ARMFilter
constructor
A new instance of ARMFilter.
- #|(other) ⇒ Object
Constructor Details
#initialize(attr, val) ⇒ ARMFilter
Returns a new instance of ARMFilter.
7 8 9 10 11 |
# File 'lib/payload/arm/attr.rb', line 7 def initialize(attr, val) @attr = attr.to_s @val = val @opval = self.class.op + val.to_s end |
Instance Attribute Details
#attr ⇒ Object (readonly)
Returns the value of attribute attr.
5 6 7 |
# File 'lib/payload/arm/attr.rb', line 5 def attr @attr end |
#opval ⇒ Object (readonly)
Returns the value of attribute opval.
5 6 7 |
# File 'lib/payload/arm/attr.rb', line 5 def opval @opval end |
#val ⇒ Object (readonly)
Returns the value of attribute val.
5 6 7 |
# File 'lib/payload/arm/attr.rb', line 5 def val @val end |
Class Method Details
.op ⇒ Object
13 14 15 |
# File 'lib/payload/arm/attr.rb', line 13 def self.op '' end |
Instance Method Details
#|(other) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/payload/arm/attr.rb', line 17 def |(other) raise TypeError, 'invalid type' unless other.is_a?(Payload::ARMFilter) raise ArgumentError, '`or` only works on the same attribute' if other.attr != @attr joined = [@opval, other.opval].join('|') Payload::ARMEqual.new(@attr, joined) end |