Class: Snafu::Models::Location
- Inherits:
-
Object
- Object
- Snafu::Models::Location
- Defined in:
- lib/snafu/models/location.rb
Overview
Defines a generic location class with id
and name
properties.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #id ⇒ Object
-
#initializer(options = {}) ⇒ Object
Accepts an options hash with
:id
or:name
. - #to_s ⇒ Object
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/snafu/models/location.rb', line 6 def name @name end |
Instance Method Details
#id ⇒ Object
12 13 14 |
# File 'lib/snafu/models/location.rb', line 12 def id @id.to_s end |
#initializer(options = {}) ⇒ Object
Accepts an options hash with :id
or :name
8 9 10 11 |
# File 'lib/snafu/models/location.rb', line 8 def initializer(={}) @id = [:id].to_s @name = [:name] end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/snafu/models/location.rb', line 15 def to_s "Glitch Generic Location: ID: #{self.id} - Name: #{self.name}" end |