Class: Sandy::Area
- Inherits:
-
Object
- Object
- Sandy::Area
- Defined in:
- lib/sandy/area.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#customers_affected ⇒ Object
readonly
Returns the value of attribute customers_affected.
-
#estimated_recovery_time ⇒ Object
readonly
Returns the value of attribute estimated_recovery_time.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#total_customers ⇒ Object
readonly
Returns the value of attribute total_customers.
Instance Method Summary collapse
-
#initialize(customers_affected, location, options = {}) ⇒ Area
constructor
A new instance of Area.
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(customers_affected, location, options = {}) ⇒ Area
Returns a new instance of Area.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sandy/area.rb', line 12 def initialize(customers_affected, location, = {}) @name = location @customers_affected = customers_affected @parent = [:parent] @total_customers = [:total_customers] @latitude = [:latitude] @longitude = [:longitude] @estimated_recovery_time = [:estimated_recovery_time] @children = [:children] || [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def children @children end |
#customers_affected ⇒ Object (readonly)
Returns the value of attribute customers_affected.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def customers_affected @customers_affected end |
#estimated_recovery_time ⇒ Object (readonly)
Returns the value of attribute estimated_recovery_time.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def estimated_recovery_time @estimated_recovery_time end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def parent @parent end |
#total_customers ⇒ Object (readonly)
Returns the value of attribute total_customers.
3 4 5 |
# File 'lib/sandy/area.rb', line 3 def total_customers @total_customers end |
Instance Method Details
#to_json(*a) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sandy/area.rb', line 27 def to_json(*a) {"name" => @name, "customers_affected" => @customers_affected, "parent" => @parent.to_s, "total_customers" => @total_customers, "latitude" => @latitude, "longitude" => @longitude, "estimated_recovery_time" => @longitude, "children" => @children }.to_json end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/sandy/area.rb', line 23 def to_s @name end |