Module: Hx::Filter
- Included in:
- Backend::HobixFilter, Backend::RawFiles, Cache, CircumfixPath, IncludeFragments, Listing::DateArchive, Listing::FlatIndex, Listing::Limit, Listing::Paginate, Listing::RecursiveIndex, NullInput, Output::LiquidTemplate, Output::LiquidTemplate::TemplateSource, Overlay, PathSubset, Site, Sort
- Defined in:
- lib/hx.rb
Overview
minimal complete definition: each_entry_path + get_entry, or each_entry
Instance Method Summary collapse
- #each_entry(selector) ⇒ Object
- #each_entry_path(selector) ⇒ Object
- #edit_entry(path, prototype = nil) ⇒ Object
- #get_entry(path) ⇒ Object
Instance Method Details
#each_entry(selector) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/hx.rb', line 52 def each_entry(selector) each_entry_path(selector) do |path| begin entry = get_entry(path) rescue NoSuchEntryError next # entries may come and go during the enumeration end yield path, entry end end |
#each_entry_path(selector) ⇒ Object
48 49 50 |
# File 'lib/hx.rb', line 48 def each_entry_path(selector) each_entry(selector) { |path, entry| yield path } end |
#edit_entry(path, prototype = nil) ⇒ Object
44 45 46 |
# File 'lib/hx.rb', line 44 def edit_entry(path, prototype=nil) raise EditingNotSupportedError, "Editing not supported for #{path}" end |
#get_entry(path) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/hx.rb', line 63 def get_entry(path) each_entry(Path.literal(path)) do |entry_path, entry| return entry end raise NoSuchEntryError, path end |