Class: TopApps::App
- Inherits:
-
Object
- Object
- TopApps::App
- Defined in:
- lib/top_apps/app.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#developer ⇒ Object
Returns the value of attribute developer.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#profile_url ⇒ Object
Returns the value of attribute profile_url.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#rating ⇒ Object
Returns the value of attribute rating.
Class Method Summary collapse
Instance Method Summary collapse
- #add_attributes_from_profile(profile_hash) ⇒ Object
-
#initialize(hash) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(hash) ⇒ App
Returns a new instance of App.
17 18 19 20 |
# File 'lib/top_apps/app.rb', line 17 def initialize(hash) hash.each { |attr_key, attr_value| send("#{attr_key}=", attr_value) } @@all << self end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def category @category end |
#developer ⇒ Object
Returns the value of attribute developer.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def developer @developer end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def notes @notes end |
#profile_url ⇒ Object
Returns the value of attribute profile_url.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def profile_url @profile_url end |
#rank ⇒ Object
Returns the value of attribute rank.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def rank @rank end |
#rating ⇒ Object
Returns the value of attribute rating.
2 3 4 |
# File 'lib/top_apps/app.rb', line 2 def @rating end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/top_apps/app.rb', line 9 def self.all @@all end |
.create_apps_from_index(index_array) ⇒ Object
5 6 7 |
# File 'lib/top_apps/app.rb', line 5 def self.create_apps_from_index(index_array) index_array.each { |index_hash| new(index_hash) } end |
.find_by_rank(rank) ⇒ Object
13 14 15 |
# File 'lib/top_apps/app.rb', line 13 def self.find_by_rank(rank) all[rank.to_i - 1] end |
Instance Method Details
#add_attributes_from_profile(profile_hash) ⇒ Object
22 23 24 |
# File 'lib/top_apps/app.rb', line 22 def add_attributes_from_profile(profile_hash) profile_hash.each { |attr_key, attr_value| send("#{attr_key}=", attr_value) } end |