Class: FrozenRecord::Scope::Matcher
- Inherits:
-
Object
- Object
- FrozenRecord::Scope::Matcher
show all
- Defined in:
- lib/frozen_record/scope.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value) ⇒ Matcher
Returns a new instance of Matcher.
310
311
312
|
# File 'lib/frozen_record/scope.rb', line 310
def initialize(value)
@value = value
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
304
305
306
|
# File 'lib/frozen_record/scope.rb', line 304
def value
@value
end
|
Class Method Details
.for(value) ⇒ Object
292
293
294
295
296
297
298
299
300
301
|
# File 'lib/frozen_record/scope.rb', line 292
def for(value)
case value
when Array
IncludeMatcher.new(value)
when Range
CoverMatcher.new(value)
else
new(value)
end
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
322
323
324
|
# File 'lib/frozen_record/scope.rb', line 322
def ==(other)
self.class == other.class && value == other.value
end
|
#hash ⇒ Object
306
307
308
|
# File 'lib/frozen_record/scope.rb', line 306
def hash
self.class.hash ^ value.hash
end
|
#match?(other) ⇒ Boolean
318
319
320
|
# File 'lib/frozen_record/scope.rb', line 318
def match?(other)
@value == other
end
|
#ranged? ⇒ Boolean
314
315
316
|
# File 'lib/frozen_record/scope.rb', line 314
def ranged?
false
end
|