Class: Yaml::Exec::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml/exec.rb

Instance Method Summary collapse

Constructor Details

#initializeCli

Returns a new instance of Cli.



8
9
10
11
12
13
14
# File 'lib/yaml/exec.rb', line 8

def initialize
  *args, path = ARGV
  abort 'command is required for 1st arg' if args.empty?
  abort 'yml file is needed for 2nd arg' if path.nil?
  @cmd = args.join ' '
  @yml = YAML.load_file path
end

Instance Method Details

#runObject



16
17
18
# File 'lib/yaml/exec.rb', line 16

def run
  cmd_list @yml
end