Class: EacRubyUtils::ActsAsImmutable::SetAccessor

Inherits:
EnumerableAccessor show all
Defined in:
lib/eac_ruby_utils/acts_as_immutable/set_accessor.rb

Constant Summary collapse

INITIAL_VALUE =
::Set.new.freeze

Constants inherited from BaseAccessor

BaseAccessor::FILTER_GET_METHOD_NAME_FORMAT, BaseAccessor::FILTER_SET_METHOD_NAME_FORMAT

Instance Method Summary collapse

Methods inherited from EnumerableAccessor

#apply, #apply_plural, #apply_singular, #immutable_value_get, #immutable_value_push, #immutable_value_set

Methods inherited from BaseAccessor

#duplicate_object, #immutable_value_get, #immutable_value_get_filtered, #immutable_value_get_filtered_method_name, #immutable_value_set_filtered, #immutable_value_set_filtered_method_name

Instance Method Details

#immutable_value_set_assert(value) ⇒ Set

Parameters:

Returns:

  • (Set)


12
13
14
15
16
17
# File 'lib/eac_ruby_utils/acts_as_immutable/set_accessor.rb', line 12

def immutable_value_set_assert(value)
  return value if value.is_a?(::Set)
  return value.to_set if value.respond_to?(:to_set)

  ::Set.new(value)
end

#initial_valueSet

Returns A empty Set.

Returns:

  • (Set)

    A empty Set.



20
21
22
# File 'lib/eac_ruby_utils/acts_as_immutable/set_accessor.rb', line 20

def initial_value
  INITIAL_VALUE
end