Class: PruneAr::BelongsToAssociationGatherer
- Inherits:
-
Object
- Object
- PruneAr::BelongsToAssociationGatherer
- Defined in:
- lib/prune_ar/belongs_to_association_gatherer.rb
Overview
Given ActiveRecord models, produces BelongsToAssociation objects
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Instance Method Summary collapse
- #associations ⇒ Object
-
#initialize(models, connection: ActiveRecord::Base.connection, logger: Logger.new(STDOUT).tap { |l| l.level = Logger::WARN }) ⇒ BelongsToAssociationGatherer
constructor
A new instance of BelongsToAssociationGatherer.
Constructor Details
#initialize(models, connection: ActiveRecord::Base.connection, logger: Logger.new(STDOUT).tap { |l| l.level = Logger::WARN }) ⇒ BelongsToAssociationGatherer
Returns a new instance of BelongsToAssociationGatherer.
12 13 14 15 16 17 18 19 20 |
# File 'lib/prune_ar/belongs_to_association_gatherer.rb', line 12 def initialize( models, connection: ActiveRecord::Base.connection, logger: Logger.new(STDOUT).tap { |l| l.level = Logger::WARN } ) @models = models @connection = connection @logger = logger end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/prune_ar/belongs_to_association_gatherer.rb', line 10 def connection @connection end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/prune_ar/belongs_to_association_gatherer.rb', line 10 def logger @logger end |
#models ⇒ Object (readonly)
Returns the value of attribute models.
10 11 12 |
# File 'lib/prune_ar/belongs_to_association_gatherer.rb', line 10 def models @models end |
Instance Method Details
#associations ⇒ Object
22 23 24 |
# File 'lib/prune_ar/belongs_to_association_gatherer.rb', line 22 def associations @associations ||= gather_belongs_to_for_models end |