Class: Textus::Handlers::Read::RdepsEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/handlers/read/rdeps_entry.rb

Instance Method Summary collapse

Constructor Details

#initialize(manifest:) ⇒ RdepsEntry

Returns a new instance of RdepsEntry.



5
6
7
# File 'lib/textus/handlers/read/rdeps_entry.rb', line 5

def initialize(manifest:)
  @manifest = manifest
end

Instance Method Details

#call(command, _call) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/textus/handlers/read/rdeps_entry.rb', line 9

def call(command, _call)
  rdeps = @manifest.data.entries.each_with_object([]) do |entry, acc|
    next unless entry.external?

    sources = Array(entry.source&.sources).compact
    acc << entry.key if sources.any? { |source| source == command.key || command.key.start_with?("#{source}.") }
  end
  Value::Result.success("key" => command.key, "rdeps" => rdeps)
end