Class: RubyModKit::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ruby_mod_kit/cli.rb

Overview

This class provides CLI commands of ruby_mod_kit.

Instance Method Summary collapse

Instance Method Details

#exec(*args) ⇒ void

This method returns an undefined value.

Parameters:

rbs:

  • *args: String

  • return: void



16
17
18
# File 'lib/ruby_mod_kit/cli.rb', line 16

def exec(*args)
  RubyModKit.execute_file(*args, config: config)
end

#transpile(*args) ⇒ void

This method returns an undefined value.

Parameters:

rbs:

  • *args: String

  • return: void



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ruby_mod_kit/cli.rb', line 26

def transpile(*args)
  output = case options[:output]
  when nil, "-", "/dev/stdout"
    $stdout
  when ".rb"
    nil
  else
    options[:output]
  end
  config = self.config
  args.each do |path|
    RubyModKit.transpile_file(path, output: output || RubyModKit.rb_path(path), config: config)
  end
end