Class: SymbolOperator
- Includes:
- Comparable
- Defined in:
- lib/mark_mapper/extensions/symbol.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(field, operator) ⇒ SymbolOperator
constructor
A new instance of SymbolOperator.
Constructor Details
#initialize(field, operator) ⇒ SymbolOperator
Returns a new instance of SymbolOperator.
55 56 57 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 55 def initialize(field, operator) @field, @operator = field, operator end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
53 54 55 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 53 def field @field end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
53 54 55 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 53 def operator @operator end |
Instance Method Details
#<=>(other) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 59 def <=>(other) if field == other.field operator <=> other.operator else field.to_s <=> other.field.to_s end end |
#==(other) ⇒ Object
75 76 77 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 75 def ==(other) other.class == self.class && field == other.field && operator == other.operator end |
#eql?(other) ⇒ Boolean
71 72 73 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 71 def eql?(other) self == other end |
#hash ⇒ Object
67 68 69 |
# File 'lib/mark_mapper/extensions/symbol.rb', line 67 def hash field.hash + operator.hash end |