Class: Blueprinter::AutoExtractor Private
- Defined in:
- lib/blueprinter/extractors/auto_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(field_name, object, local_options, options = {}) ⇒ Object private
-
#initialize ⇒ AutoExtractor
constructor
private
A new instance of AutoExtractor.
Methods inherited from Extractor
Constructor Details
#initialize ⇒ AutoExtractor
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 AutoExtractor.
4 5 6 7 8 9 |
# File 'lib/blueprinter/extractors/auto_extractor.rb', line 4 def initialize @hash_extractor = HashExtractor.new @public_send_extractor = PublicSendExtractor.new @block_extractor = BlockExtractor.new @datetime_formatter = DateTimeFormatter.new end |
Instance Method Details
#extract(field_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.
11 12 13 14 15 |
# File 'lib/blueprinter/extractors/auto_extractor.rb', line 11 def extract(field_name, object, , = {}) extraction = extractor(object, ).extract(field_name, object, , ) value = @datetime_formatter.format(extraction, ) value.nil? ? default_value() : value end |