Class: Top25::Place
- Inherits:
-
Object
- Object
- Top25::Place
- Defined in:
- lib/top25/place.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#num ⇒ Object
Returns the value of attribute num.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attr_hash) ⇒ Place
constructor
“”, location: “”, :address =>“”.
Constructor Details
#initialize(attr_hash) ⇒ Place
“”, location: “”, :address =>“”
4 5 6 7 8 9 |
# File 'lib/top25/place.rb', line 4 def initialize(attr_hash) #{name: "", location: "", :address =>""} attr_hash.each do |attribute, v| self.send("#{attribute}=",v) end @@all << self end |
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
2 3 4 |
# File 'lib/top25/place.rb', line 2 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/top25/place.rb', line 2 def name @name end |
#num ⇒ Object
Returns the value of attribute num.
2 3 4 |
# File 'lib/top25/place.rb', line 2 def num @num end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/top25/place.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
11 12 13 |
# File 'lib/top25/place.rb', line 11 def self.all @@all end |
.create_from_collection(arr) ⇒ Object
15 16 17 18 19 |
# File 'lib/top25/place.rb', line 15 def self.create_from_collection(arr) arr.each do |hash| self.new(hash) end end |