Class: Blueprinter::Field Private

Inherits:
Object
  • Object
show all
Defined in:
lib/blueprinter/field.rb

Overview

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.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, name, extractor, blueprint, options = {}) ⇒ Field

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 Field.

API:

  • private



8
9
10
11
12
13
14
# File 'lib/blueprinter/field.rb', line 8

def initialize(method, name, extractor, blueprint, options = {})
  @method = method
  @name = name
  @extractor = extractor
  @blueprint = blueprint
  @options = options
end

Instance Attribute Details

#blueprintObject (readonly)

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.

API:

  • private



6
7
8
# File 'lib/blueprinter/field.rb', line 6

def blueprint
  @blueprint
end

#extractorObject (readonly)

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.

API:

  • private



6
7
8
# File 'lib/blueprinter/field.rb', line 6

def extractor
  @extractor
end

#methodObject (readonly)

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.

API:

  • private



6
7
8
# File 'lib/blueprinter/field.rb', line 6

def method
  @method
end

#nameObject (readonly)

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.

API:

  • private



6
7
8
# File 'lib/blueprinter/field.rb', line 6

def name
  @name
end

#optionsObject (readonly)

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.

API:

  • private



6
7
8
# File 'lib/blueprinter/field.rb', line 6

def options
  @options
end

Instance Method Details

#extract(object, local_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.

API:

  • private



16
17
18
# File 'lib/blueprinter/field.rb', line 16

def extract(object, local_options)
  extractor.extract(method, object, local_options, options)
end

#skip?(field_name, object, local_options) ⇒ Boolean

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:

API:

  • private



20
21
22
23
24
# File 'lib/blueprinter/field.rb', line 20

def skip?(field_name, object, local_options)
  return true if if_callable && !if_callable.call(field_name, object, local_options)

  unless_callable && unless_callable.call(field_name, object, local_options)
end