Class: MagicScopes::ScopesGenerator::Base
- Inherits:
-
Object
- Object
- MagicScopes::ScopesGenerator::Base
- Defined in:
- lib/magic_scopes/scopes_generators/base.rb
Direct Known Subclasses
AssociationScopesGenerator, BooleanScopesGenerator, FloatScopesGenerator, NumericScopesGenerator, MagicScopes::StateScopesGenerator, MagicScopes::StringScopesGenerator
Constant Summary collapse
- @@instances =
{}
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model, attr) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(model, attr) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/magic_scopes/scopes_generators/base.rb', line 9 def initialize(model, attr) @model = model @attr = attr @key = "#{model.table_name}.#{attr}" end |
Class Method Details
.instance(model, attr) ⇒ Object
15 16 17 18 |
# File 'lib/magic_scopes/scopes_generators/base.rb', line 15 def self.instance(model, attr) @@instances[model.name] ||= {} @@instances[model.name][attr] ||= new(model, attr) end |