Class: Shale::Mapping::Descriptor::Dict Private

Inherits:
Object
  • Object
show all
Defined in:
lib/shale/mapping/descriptor/dict.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.

Class representing attribute mapping

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, attribute:, receiver:, methods:, group:, render_nil:, schema: nil) ⇒ Dict

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.

Initialize instance

Parameters:

  • name (String)
  • attribute (Symbol, nil)
  • receiver (Symbol, nil)
  • methods (Hash, nil)
  • group (String, nil)
  • render_nil (true, false)
  • schema (Hash, nil) (defaults to: nil)


70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/shale/mapping/descriptor/dict.rb', line 70

def initialize(name:, attribute:, receiver:, methods:, group:, render_nil:, schema: nil)
  @name = name
  @attribute = attribute
  @receiver = receiver
  @group = group
  @render_nil = render_nil
  @schema = schema

  if methods
    @method_from = methods[:from]
    @method_to = methods[:to]
  end
end

Instance Attribute Details

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

Return attribute name

Returns:

  • (Symbol)


22
23
24
# File 'lib/shale/mapping/descriptor/dict.rb', line 22

def attribute
  @attribute
end

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

Return group name

Returns:

  • (String)


50
51
52
# File 'lib/shale/mapping/descriptor/dict.rb', line 50

def group
  @group
end

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

Return method symbol

Returns:

  • (Symbol)


36
37
38
# File 'lib/shale/mapping/descriptor/dict.rb', line 36

def method_from
  @method_from
end

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

Return method symbol

Returns:

  • (Symbol)


43
44
45
# File 'lib/shale/mapping/descriptor/dict.rb', line 43

def method_to
  @method_to
end

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

Return mapping name

Returns:

  • (String)


15
16
17
# File 'lib/shale/mapping/descriptor/dict.rb', line 15

def name
  @name
end

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

Return receiver name

Returns:

  • (Symbol)


29
30
31
# File 'lib/shale/mapping/descriptor/dict.rb', line 29

def receiver
  @receiver
end

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

Return schema hash

Returns:

  • (Hash)


57
58
59
# File 'lib/shale/mapping/descriptor/dict.rb', line 57

def schema
  @schema
end

Instance Method Details

#render_nil?true, false

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.

Check render_nil

Returns:

  • (true, false)


89
90
91
# File 'lib/shale/mapping/descriptor/dict.rb', line 89

def render_nil?
  @render_nil == true
end