Class: HastCI::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/hastci/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:) ⇒ Task

Returns a new instance of Task.



7
8
9
10
11
# File 'lib/hastci/task.rb', line 7

def initialize(id:, name:)
  @id = id
  @name = name
  freeze
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/hastci/task.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/hastci/task.rb', line 5

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



13
14
15
# File 'lib/hastci/task.rb', line 13

def ==(other)
  other.is_a?(Task) && other.id == id && other.name == name
end

#hashObject



19
20
21
# File 'lib/hastci/task.rb', line 19

def hash
  [id, name].hash
end