Class: Textus::Application::Read::List::Impl

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/read/list.rb

Instance Method Summary collapse

Constructor Details

#initialize(caps:) ⇒ Impl

Returns a new instance of Impl.



10
11
12
# File 'lib/textus/application/read/list.rb', line 10

def initialize(caps:)
  @manifest = caps.manifest
end

Instance Method Details

#call(prefix: nil, zone: nil) ⇒ Object



14
15
16
17
18
# File 'lib/textus/application/read/list.rb', line 14

def call(prefix: nil, zone: nil)
  rows = @manifest.resolver.enumerate(prefix: prefix)
  rows = rows.select { |r| r[:manifest_entry].zone == zone } if zone
  rows.map { |row| { "key" => row[:key], "zone" => row[:manifest_entry].zone, "path" => row[:path] } }
end