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:



67
68
69
70
71
72
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/keyable.rb', line 67

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:



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

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

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