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



4
5
6
7
8
9
10
# File 'lib/blueprinter/field.rb', line 4

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



3
4
5
# File 'lib/blueprinter/field.rb', line 3

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



3
4
5
# File 'lib/blueprinter/field.rb', line 3

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



3
4
5
# File 'lib/blueprinter/field.rb', line 3

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



3
4
5
# File 'lib/blueprinter/field.rb', line 3

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



3
4
5
# File 'lib/blueprinter/field.rb', line 3

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



12
13
14
# File 'lib/blueprinter/field.rb', line 12

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



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

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