Class: Pragma::Decorator::Association::Reflection Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pragma/decorator/association/reflection.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.

Holds the information about an association.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, property, **options) ⇒ Reflection

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.

Initializes the association.

Parameters:

  • type (Symbol)

    the type of the association

  • property (Symbol)

    the property holding the associated object

  • options (Hash)

    additional options

Options Hash (**options):

  • :decorator (Class|Proc)

    the decorator to use for the associated object or a callable that will return the decorator class (or nil to skip decoration)

  • :render_nil (Boolean) — default: `true`

    whether to render a nil association

  • :exec_context (Symbol) — default: `decorated`

    whether to call the getter on the decorator (decorator) or the decorated object (decorated)



31
32
33
34
35
36
37
38
# File 'lib/pragma/decorator/association/reflection.rb', line 31

def initialize(type, property, **options)
  @type = type
  @property = property
  @options = options

  normalize_options
  validate_options
end

Instance Attribute Details

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



18
# File 'lib/pragma/decorator/association/reflection.rb', line 18

attr_reader :type, :property, :options

#propertySymbol (readonly)

Returns the property holding the associated object.

Returns:

  • (Symbol)

    the property holding the associated object



18
# File 'lib/pragma/decorator/association/reflection.rb', line 18

attr_reader :type, :property, :options

#typeSymbol (readonly)

Returns the type of the association.

Returns:

  • (Symbol)

    the type of the association



18
19
20
# File 'lib/pragma/decorator/association/reflection.rb', line 18

def type
  @type
end