Class: Rerout::Models::Project
- Inherits:
-
Object
- Object
- Rerout::Models::Project
- Defined in:
- lib/rerout/models.rb
Overview
Project identity envelope.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(id:, name:, slug:) ⇒ Project
constructor
A new instance of Project.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, slug:) ⇒ Project
Returns a new instance of Project.
246 247 248 249 250 251 |
# File 'lib/rerout/models.rb', line 246 def initialize(id:, name:, slug:) @id = id @name = name @slug = slug freeze end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
244 245 246 |
# File 'lib/rerout/models.rb', line 244 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
244 245 246 |
# File 'lib/rerout/models.rb', line 244 def name @name end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
244 245 246 |
# File 'lib/rerout/models.rb', line 244 def slug @slug end |
Class Method Details
.from_hash(hash) ⇒ Object
253 254 255 |
# File 'lib/rerout/models.rb', line 253 def self.from_hash(hash) new(id: hash['id'], name: hash['name'], slug: hash['slug']) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
261 262 263 |
# File 'lib/rerout/models.rb', line 261 def ==(other) other.is_a?(Project) && other.to_h == to_h end |
#hash ⇒ Object
266 267 268 |
# File 'lib/rerout/models.rb', line 266 def hash [self.class, id, name, slug].hash end |
#to_h ⇒ Object
257 258 259 |
# File 'lib/rerout/models.rb', line 257 def to_h { id: id, name: name, slug: slug } end |