Method: Blueprinter::Base.field
- Defined in:
- lib/blueprinter/base.rb
.field(method, options = {}) {|object, options| ... } ⇒ Field
Specify a field or method name to be included for serialization. Takes a required method and an option.
122 123 124 125 126 127 128 129 130 |
# File 'lib/blueprinter/base.rb', line 122 def self.field(method, = {}, &block) current_view << Field.new( method, .fetch(:name) { method }, .fetch(:extractor) { Blueprinter.configuration.extractor_default.new }, self, .merge(block: block) ) end |