Class: Snafu::Models::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/snafu/models/location.rb

Overview

Defines a generic location class with id and name properties.

Direct Known Subclasses

Hub, Street

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (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

#idObject



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(options={})
  @id = options[:id].to_s
  @name = options[:name]
end

#to_sObject



15
16
17
# File 'lib/snafu/models/location.rb', line 15

def to_s
  "Glitch Generic Location: ID: #{self.id} - Name: #{self.name}"
end