Class: Blueprinter::AssociationExtractor Private
- Defined in:
- lib/blueprinter/extractors/association_extractor.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #extract(association_name, object, local_options, options = {}) ⇒ Object private
-
#initialize ⇒ AssociationExtractor
constructor
private
A new instance of AssociationExtractor.
Methods inherited from Extractor
Constructor Details
#initialize ⇒ AssociationExtractor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AssociationExtractor.
4 5 6 |
# File 'lib/blueprinter/extractors/association_extractor.rb', line 4 def initialize @extractor = AutoExtractor.new end |
Instance Method Details
#extract(association_name, object, local_options, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 11 12 13 14 15 |
# File 'lib/blueprinter/extractors/association_extractor.rb', line 8 def extract(association_name, object, , ={}) = .reject { |k,_| k == :default } value = @extractor.extract(association_name, object, , ) return default_value() if value.nil? view = [:view] || :default blueprint = association_blueprint([:blueprint], value) blueprint.prepare(value, view_name: view, local_options: ) end |