Module: EacRubyBase0::Runner

Defined in:
lib/eac_ruby_base0/runner.rb

Defined Under Namespace

Classes: FailIfRequestInput

Instance Method Summary collapse

Instance Method Details

#application_versionObject



35
36
37
# File 'lib/eac_ruby_base0/runner.rb', line 35

def application_version
  runner_context.call(:application).version.to_s
end

#on_context(&block) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/eac_ruby_base0/runner.rb', line 39

def on_context(&block)
  top_block = block
  available_contexts.each do |context|
    next if context.object.any?

    last_block = top_block
    top_block = ::Proc.new { context.object.on(context.builder.call, &last_block) }
  end
  top_block.call
end

#runObject



25
26
27
28
29
30
31
32
33
# File 'lib/eac_ruby_base0/runner.rb', line 25

def run
  on_context do
    if parsed.version?
      show_version
    else
      run_with_subcommand
    end
  end
end

#show_versionObject



50
51
52
# File 'lib/eac_ruby_base0/runner.rb', line 50

def show_version
  out("#{application_version}\n")
end