Class: MagicScopes::NumericScopesGenerator

Inherits:
ScopesGenerator::Base show all
Includes:
ComparisonScopes, EqualityScopes, OrderScopes
Defined in:
lib/magic_scopes/scopes_generators/numeric.rb

Instance Method Summary collapse

Methods included from ComparisonScopes

#gt, #lt

Methods included from OrderScopes

#by, #by_desc

Methods included from EqualityScopes

#eq, #ne, #with, #without

Methods inherited from ScopesGenerator::Base

#initialize, instance

Constructor Details

This class inherits a constructor from MagicScopes::ScopesGenerator::Base

Instance Method Details

#gte(name) ⇒ Object



8
9
10
# File 'lib/magic_scopes/scopes_generators/numeric.rb', line 8

def gte(name)
  scope name || "#{@attr}_gte", ->(val) { where("#{@key} >= ?", val) }
end

#lte(name) ⇒ Object



12
13
14
# File 'lib/magic_scopes/scopes_generators/numeric.rb', line 12

def lte(name)
  scope name || "#{@attr}_lte", ->(val) { where("#{@key} <= ?", val) }
end