Class: Cuby

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

Constant Summary collapse

VERSION =
File.read(File.dirname(File.dirname(__FILE__)) + "/VERSION")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, stdin) ⇒ Cuby

Returns a new instance of Cuby.



23
24
25
26
27
28
29
# File 'lib/cuby.rb', line 23

def initialize(arguments, stdin)
  @arguments = arguments
  @stdin = stdin
  
  # Set defaults
  @options = OpenStruct.new
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/cuby.rb', line 21

def options
  @options
end

Instance Method Details

#runObject

Parse options, check arguments, then process the command



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cuby.rb', line 32

def run
  
  if parsed_options? && arguments_valid?
    
    puts "Start at #{DateTime.now}\n\n" if @options.verbose
    
    process_arguments
    process_command
    
    puts "\nFinished at #{DateTime.now}" if @options.verbose
    
  else
    output_usage
  end
  
end