Class: ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Type

Inherits:
Object
  • Object
show all
Includes:
Concern, Support::Castable, Support::Delegate
Defined in:
lib/convenient_service/common/plugins/can_have_callbacks/entities/type.rb,
lib/convenient_service/common/plugins/can_have_callbacks/entities/type/concern.rb

Defined Under Namespace

Modules: Concern

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concern

after, around, before, callback, callbacks

Methods included from Support::Delegate::ClassMethodsForForwardable

#delegate

Methods included from Support::Castable

cast!

Methods included from Support::AbstractMethod

abstract_method

Constructor Details

#initialize(value:) ⇒ void

Parameters:

  • value (Symbol)


31
32
33
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type.rb', line 31

def initialize(value:)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20
21
22
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type.rb', line 20

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


39
40
41
42
43
44
45
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type.rb', line 39

def ==(other)
  return unless other.instance_of?(self.class)

  return false if value != other.value

  true
end

#eql?(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


59
60
61
62
63
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type.rb', line 59

def eql?(other)
  return unless other.instance_of?(self.class)

  hash == other.hash
end

#hashInteger

Returns:

  • (Integer)


25
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type.rb', line 25

delegate :hash, to: :value