class Blueprinter::Base
def self.field(method, options = {}, &block)
-
(Field)- A Field object
Other tags:
- Example: Passing an if proc and unless method. -
Example: Passing a block to be evaluated as the value. -
Example: Specifying a user's first_name to be serialized. -
Other tags:
- Yield: - The object and the options passed to render are
Options Hash:
(**options)-
:unless(Symbol, Proc) -- Specifies a method, proc or string -
:if(Symbol, Proc) -- Specifies a method, proc or string to -
:datetime_format(String, Proc) -- Format Date or DateTime object -
:name(Symbol) -- Use this to rename the method. Useful if -
:extractor(AssociationExtractor, BlockExtractor, HashExtractor, PublicSendExtractor) --
Parameters:
-
options(Hash) -- options to overide defaults. -
method(Symbol) -- the field or method name you want to include for
def self.field(method, options = {}, &block) current_view << Field.new( method, options.fetch(:name) { method }, options.fetch(:extractor) { Blueprinter.configuration.extractor_default.new }, self, options.merge(block: block) ) end