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.



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

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



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

def run
  cmd_list @yml
end