Class: Snafu::Models::Street
- Defined in:
- lib/snafu/models/street.rb
Instance Attribute Summary collapse
-
#active_project ⇒ Object
(also: #active_project?)
readonly
Returns the value of attribute active_project.
-
#connections ⇒ Object
readonly
Returns the value of attribute connections.
-
#features ⇒ Object
readonly
Returns the value of attribute features.
-
#hub ⇒ Object
readonly
Returns the value of attribute hub.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#mote ⇒ Object
readonly
Returns the value of attribute mote.
Attributes inherited from Location
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Street
constructor
A new instance of Street.
- #to_s ⇒ Object
Methods inherited from Location
Constructor Details
#initialize(options = {}) ⇒ Street
Returns a new instance of Street.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/snafu/models/street.rb', line 7 def initialize( = {}) if .class == HTTParty::Response @id = ["tsid"] @name = ["name"] @hub = Hub.new(:id => ["hub"]["id"], :name => ["hub"]["name"]) @features = ["features"] @connections = [] ["connections"].each do |street_id, street| @connections << Street.new( :id => street_id, :name => street["name"], :hub => Hub.new(:id => ["hub"]["id"], :name => ["hub"]["name"]), :mote => Hub.new(:id => ["mote"]["id"], :name => ["mote"]["name"]), ) end @mote = Hub.new(:id => ["mote"]["id"], :name => ["mote"]["name"]) unless ["image"].nil? @image = GlitchImage.new( :url => ["image"]["url"], :width => ["image"]["w"], :height => ["image"]["h"] ) end @active_project = ["active_project"] else @id = [:id] @name = [:name] @hub = [:hub] @features = [:features] @connections = [:connections] || [] @mote = [:mote] @image = [:image] @active_project = [:active_project] || false end end |
Instance Attribute Details
#active_project ⇒ Object (readonly) Also known as: active_project?
Returns the value of attribute active_project.
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def active_project @active_project end |
#connections ⇒ Object (readonly)
Returns the value of attribute connections.
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def connections @connections end |
#features ⇒ Object (readonly)
Returns the value of attribute features.
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def features @features end |
#hub ⇒ Object (readonly)
Returns the value of attribute hub.
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def hub @hub end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def image @image end |
#mote ⇒ Object (readonly)
Returns the value of attribute mote.
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def mote @mote end |
Instance Method Details
#to_s ⇒ Object
44 45 46 |
# File 'lib/snafu/models/street.rb', line 44 def to_s "Glitch Street: #{self.id} - #{self.name}" end |