Class: SymbolOperator
- Includes:
- Comparable
- Defined in:
- lib/storage_room/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
-
#initialize(field, operator, options = {}) ⇒ SymbolOperator
constructor
A new instance of SymbolOperator.
- #to_s ⇒ Object
Constructor Details
#initialize(field, operator, options = {}) ⇒ SymbolOperator
Returns a new instance of SymbolOperator.
68 69 70 |
# File 'lib/storage_room/extensions/symbol.rb', line 68 def initialize(field, operator, ={}) @field, @operator = field, operator end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
66 67 68 |
# File 'lib/storage_room/extensions/symbol.rb', line 66 def field @field end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
66 67 68 |
# File 'lib/storage_room/extensions/symbol.rb', line 66 def operator @operator end |
Instance Method Details
#<=>(other) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/storage_room/extensions/symbol.rb', line 72 def <=>(other) if field == other.field operator <=> other.operator else field.to_s <=> other.field.to_s end end |
#==(other) ⇒ Object
80 81 82 |
# File 'lib/storage_room/extensions/symbol.rb', line 80 def ==(other) field == other.field && operator == other.operator end |
#to_s ⇒ Object
84 85 86 |
# File 'lib/storage_room/extensions/symbol.rb', line 84 def to_s "#{field}!#{operator}" end |