Class: Hx::Listing::Limit
- Inherits:
-
Object
- Object
- Hx::Listing::Limit
- Includes:
- Filter
- Defined in:
- lib/hx/listing/limit.rb
Instance Method Summary collapse
- #each_entry(selector) ⇒ Object
-
#initialize(input, options) ⇒ Limit
constructor
A new instance of Limit.
Methods included from Filter
Methods included from View
Constructor Details
#initialize(input, options) ⇒ Limit
Returns a new instance of Limit.
32 33 34 35 |
# File 'lib/hx/listing/limit.rb', line 32 def initialize(input, ) @input = input @limit = [:limit] end |
Instance Method Details
#each_entry(selector) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hx/listing/limit.rb', line 37 def each_entry(selector) @input.each_entry(selector) do |path, entry| if entry['items'] trimmed_entry = entry.dup trimmed_entry['items'] = entry['items'][0...@limit] else trimmed_entry = entry end yield path, trimmed_entry end self end |