Module: MARC::Spec::Queries::Part
- Included in:
- Applicable, ComparisonString, Condition, PositionOrRange, Query, QueryExecutor
- Defined in:
- lib/marc/spec/queries/part.rb
Overview
Supermodule of partial query
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#inspect ⇒ Object
———————————————————— Object overrides.
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
14 15 16 17 18 19 20 |
# File 'lib/marc/spec/queries/part.rb', line 14 def eql?(other) return false unless other.class == self.class equality_attrs.all? do |attr| send(attr) == other.send(attr) end end |
#hash ⇒ Object
24 25 26 27 28 29 |
# File 'lib/marc/spec/queries/part.rb', line 24 def hash @hash_val ||= begin equality_vals = equality_attrs.map { |attr| send(attr) } equality_vals.inject(31 + self.class.hash) { |r, v| 31 * r + v.hash } end end |
#inspect ⇒ Object
Object overrides
10 11 12 |
# File 'lib/marc/spec/queries/part.rb', line 10 def inspect "#{class_name(self)}<#{to_s_inspect}>" end |