Class: Textus::Protocol::Handlers::Ops::SourceExpander

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/protocol/handlers/ops/source_expander.rb

Instance Method Summary collapse

Instance Method Details

#call(env, ctx:, depth: 0) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/textus/protocol/handlers/ops/source_expander.rb', line 6

def call(env, ctx:, depth: 0)
  return env if depth >= 5

  raw_sources = Array(env.meta["sources"])
  return env if raw_sources.empty?

  expanded = raw_sources.map { |src| expand_one(src, ctx:, depth:) }
  env.with(sources: expanded)
end