Module: Ecoportal::API::Common::Content::DoubleModel::Attributable::Nesting::Keyable

Extended by:
Includer
Defined in:
lib/ecoportal/api/common/content/double_model/attributable/nesting/keyable.rb

Defined Under Namespace

Modules: ClassMethods Classes: NoKeyMethod

Instance Method Summary collapse

Methods included from Includer

include_missing

Instance Method Details

#keyString

Returns the value of the key method (i.e. id value).

Returns:

  • (String)

    the value of the key method (i.e. id value)

Raises:



73
74
75
76
77
78
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/keyable.rb', line 73

def key
  msg = "No key_method defined for #{self.class}"
  raise NoKeyMethod, msg unless key_method?

  method(key_method).call
end

#key=(value) ⇒ Object

Parameters:

  • the (String)

    value of the key method (i.e. id value)

Raises:



81
82
83
84
85
86
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/keyable.rb', line 81

def key=(value)
  msg = "No key_method defined for #{self.class}"
  raise NoKeyMethod, msg unless key_method?

  method("#{key_method}=").call(value)
end