Class: Textus::Read::List

Inherits:
Object
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/read/list.rb

Instance Method Summary collapse

Methods included from Contract::DSL

arg, contract, contract?, response, summary, surfaces, verb

Constructor Details

#initialize(container:, call: nil) ⇒ List

rubocop:disable Lint/UnusedMethodArgument



12
13
14
# File 'lib/textus/read/list.rb', line 12

def initialize(container:, call: nil) # rubocop:disable Lint/UnusedMethodArgument
  @manifest = container.manifest
end

Instance Method Details

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



16
17
18
19
20
# File 'lib/textus/read/list.rb', line 16

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