Class: Multicodecs::Registration

Inherits:
Struct
  • Object
show all
Defined in:
lib/multicodecs/registry.rb

Overview

rubocop:enable Style/MutableConstant

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



16
17
18
# File 'lib/multicodecs/registry.rb', line 16

def code
  @code
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



16
17
18
# File 'lib/multicodecs/registry.rb', line 16

def name
  @name
end

#tagObject

Returns the value of attribute tag

Returns:

  • (Object)

    the current value of tag



16
17
18
# File 'lib/multicodecs/registry.rb', line 16

def tag
  @tag
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
24
25
26
# File 'lib/multicodecs/registry.rb', line 21

def ==(other)
  return name == other if other.is_a?(String)
  return code == other if other.is_a?(Integer)

  eql?(other)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/multicodecs/registry.rb', line 28

def eql?(other)
  other.is_a?(Registration) && other.name == name
end

#hashObject



17
18
19
# File 'lib/multicodecs/registry.rb', line 17

def hash
  name.hash
end