Class: Snafu::Models::Street
- Inherits:
-
Location
- Object
- Location
- Snafu::Models::Street
- Defined in:
- lib/snafu/models/street.rb
Instance Attribute Summary (collapse)
-
- (Object) active_project
(also: #active_project?)
readonly
Returns the value of attribute active_project.
-
- (Object) connections
readonly
Returns the value of attribute connections.
-
- (Object) features
readonly
Returns the value of attribute features.
-
- (Object) hub
readonly
Returns the value of attribute hub.
-
- (Object) image
readonly
Returns the value of attribute image.
-
- (Object) mote
readonly
Returns the value of attribute mote.
Attributes inherited from Location
Instance Method Summary (collapse)
-
- (Street) initialize(options = {})
constructor
A new instance of Street.
- - (Object) to_s
Methods inherited from Location
Constructor Details
- (Street) initialize(options = {})
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
- (Object) active_project (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 |
- (Object) connections (readonly)
Returns the value of attribute connections
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def connections @connections end |
- (Object) features (readonly)
Returns the value of attribute features
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def features @features end |
- (Object) hub (readonly)
Returns the value of attribute hub
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def hub @hub end |
- (Object) image (readonly)
Returns the value of attribute image
4 5 6 |
# File 'lib/snafu/models/street.rb', line 4 def image @image end |
- (Object) mote (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
- (Object) to_s
44 45 46 |
# File 'lib/snafu/models/street.rb', line 44 def to_s "Glitch Street: #{self.id} - #{self.name}" end |