Class: Txbr::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/txbr/metadata.rb

Constant Summary collapse

ASSIGNMENTS =
%w(project_slug resource_slug prefix)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Metadata

Returns a new instance of Metadata.



7
8
9
10
11
# File 'lib/txbr/metadata.rb', line 7

def initialize(options = {})
  @project_slug = options['project_slug']
  @resource_slug = options['resource_slug']
  @prefix = options['prefix']
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



5
6
7
# File 'lib/txbr/metadata.rb', line 5

def prefix
  @prefix
end

#project_slugObject (readonly)

Returns the value of attribute project_slug.



5
6
7
# File 'lib/txbr/metadata.rb', line 5

def project_slug
  @project_slug
end

#resource_slugObject (readonly)

Returns the value of attribute resource_slug.



5
6
7
# File 'lib/txbr/metadata.rb', line 5

def resource_slug
  @resource_slug
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
# File 'lib/txbr/metadata.rb', line 13

def ==(other)
  project_slug == other.project_slug &&
    resource_slug == other.resource_slug &&
    prefix == prefix
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/txbr/metadata.rb', line 19

def eql?(other)
  hash == other.hash
end

#hashObject



23
24
25
26
27
28
# File 'lib/txbr/metadata.rb', line 23

def hash
  h = 7
  h = 31 * h + project_slug.hash
  h = 31 * h + resource_slug.hash
  h = 31 * h + prefix.hash
end