Class: Middleman::Pagination::Configuration
- Inherits:
-
Object
- Object
- Middleman::Pagination::Configuration
- Includes:
- Enumerable
- Defined in:
- lib/middleman/pagination/configuration.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #pageable(name, &block) ⇒ Object
- #pageable_resource(name, &block) ⇒ Object
- #pageable_set(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 |
# File 'lib/middleman/pagination/configuration.rb', line 6 def initialize @pageable = {} end |
Instance Method Details
#each(&block) ⇒ Object
28 29 30 31 32 |
# File 'lib/middleman/pagination/configuration.rb', line 28 def each(&block) @pageable.each do |name, pageable_obj| yield pageable_obj end end |
#pageable(name, &block) ⇒ Object
10 11 12 13 |
# File 'lib/middleman/pagination/configuration.rb', line 10 def pageable(name, &block) warn "`pageable` is deprecated, use `pageable_resource` instead" pageable_resource(name, &block) end |
#pageable_resource(name, &block) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/middleman/pagination/configuration.rb', line 15 def pageable_resource(name, &block) @pageable[name] = Pageable.new(name) do resources.select do |resource| next if resource.ignored? block.call(resource) end.sort_by(&:path) end end |
#pageable_set(name, &block) ⇒ Object
24 25 26 |
# File 'lib/middleman/pagination/configuration.rb', line 24 def pageable_set(name, &block) @pageable[name] = Pageable.new(name, &block) end |