Class: Rundoc::CodeCommand::RundocCommand::EnsureLaterArgs

Inherits:
Object
  • Object
show all
Defined in:
lib/rundoc/code_command/rundoc/ensure_later.rb

Constant Summary collapse

MAPPING =
{
  cwd: ->(context:) {
    Dir.pwd
  },
  rundoc_root: ->(context:) {
    context.output_dir.to_s
  }
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(dir:) ⇒ EnsureLaterArgs

Returns a new instance of EnsureLaterArgs.



15
16
17
18
# File 'lib/rundoc/code_command/rundoc/ensure_later.rb', line 15

def initialize(dir:)
  @dir = dir
  @logic = MAPPING[dir] or raise ArgumentError, "Invalid argument dir: #{dir} must be one of #{MAPPING.keys}"
end

Instance Method Details

#call(context:) ⇒ Object



20
21
22
# File 'lib/rundoc/code_command/rundoc/ensure_later.rb', line 20

def call(context:)
  @logic.call(context: context)
end

#to_sObject



24
25
26
# File 'lib/rundoc/code_command/rundoc/ensure_later.rb', line 24

def to_s
  @dir
end