Module: PopularPages
- Defined in:
- lib/popular_pages.rb,
lib/popular_pages/rest_client.rb,
lib/popular_pages/configuration.rb
Defined Under Namespace
Classes: Configuration, RestClient
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
8 9 10 |
# File 'lib/popular_pages.rb', line 8 def configuration @configuration end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
11 12 13 14 |
# File 'lib/popular_pages.rb', line 11 def self.configure self.configuration ||= Configuration.new yield(configuration) end |
.most_populars(from = 7, to = 1, paths = []) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/popular_pages.rb', line 16 def self.most_populars(from = 7, to = 1, paths = []) all = @rest_client.all(from, to) return all if paths.empty? populars = [] paths.each do |path| populars += all.select { |page| page[:path].match(/\A\/#{path}/) } end populars end |