diff options
| author | Zack Hobson | 2011-12-30 19:32:54 -0800 | 
|---|---|---|
| committer | Zack Hobson | 2011-12-30 19:32:54 -0800 | 
| commit | 3d8a797c6d0223189ac921ae28c9056e71f0e0ae (patch) | |
| tree | 609324e0838c361e661dfa62537ff13bea7d8876 /lib | |
| parent | 52b158e13aafb59055a3151ea5ef7325646ab1de (diff) | |
| download | hcl-3d8a797c6d0223189ac921ae28c9056e71f0e0ae.tar.bz2 | |
ruby 1.9.x fixes
fixed some warnings and errors on modern rubies
also fixed an issue with the "stop" command not accepting a message
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/hcl/app.rb | 12 | ||||
| -rw-r--r-- | lib/hcl/commands.rb | 3 | 
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb index 6d514da..83c52ca 100644 --- a/lib/hcl/app.rb +++ b/lib/hcl/app.rb @@ -54,7 +54,7 @@ module HCl      # @param [#to_s] command name of command      # @return [true, false]      def command? command -      Commands.instance_methods.include? command.to_s +      Commands.method_defined? command      end      # Start the application. @@ -64,8 +64,8 @@ module HCl            if command? @command              result = send @command, *@args              if not result.nil? -              if result.respond_to? :to_a -                puts result.to_a.join(', ') +              if result.respond_to? :join +                puts result.join(', ')                elsif result.respond_to? :to_s                  puts result                end @@ -136,9 +136,9 @@ EOM        else          config = {}          puts "Please specify your Harvest credentials.\n" -        config['login'] = ask("Email Address: ") -        config['password'] = ask("Password: ") { |q| q.echo = false } -        config['subdomain'] = ask("Subdomain: ") +        config['login'] = ask("Email Address: ").to_s +        config['password'] = ask("Password: ") { |q| q.echo = false }.to_s +        config['subdomain'] = ask("Subdomain: ").to_s          config['ssl'] = %w(y yes).include?(ask("Use SSL? (y/n): ").downcase)          TimesheetResource.configure config          write_config config diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb index 6d2619b..47fd93b 100644 --- a/lib/hcl/commands.rb +++ b/lib/hcl/commands.rb @@ -54,9 +54,10 @@ module HCl        puts "Started timer for #{timer} (at #{current_time})"      end -    def stop +    def stop *args        entry = DayEntry.with_timer        if entry +        entry.append_note(*args.join(' ')) if args.any?          entry.toggle          puts "Stopped #{entry} (at #{current_time})"        else  | 
