Class: Blueprinter::AssociationExtractor Private

Inherits:
Extractor
  • Object
show all
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

Methods inherited from Extractor

extract, #initialize

Constructor Details

This class inherits a constructor from Blueprinter::Extractor

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.



3
4
5
6
7
8
# File 'lib/blueprinter/extractors/association_extractor.rb', line 3

def extract(association_name, object, local_options, options={})
  value = object.public_send(association_name)
  return (value || options[:default]) if value.nil?
  view = options[:view] || :default
  options[:blueprint].prepare(value, view_name: view, local_options: local_options)
end