lib/imgurr/command.rb
# Public: allows main access to most commands.
#
# Returns output based on method calls.
allows main access to most commands.
Returns output based on method calls.
allows main access to most commands . Returns output based on method calls .
def delegate(command, major, minor)
        return help        unless command
        return no_internet unless self.internet_connection?
        return capture     if command == 'capture' || command == 'cap'
        if major
          return upload(major)       if command == 'upload' || command == 'up' || command == 'u'
          if major =~ /.*imgur\.com\/[a-zA-Z0-9]*\.[a-zA-Z]*/
            major = /com\/[a-zA-Z0-9]*/.match(major).to_s.gsub('com/','')
          end
          return unless valid_id major
          return info(major)         if command == 'info' || command == 'i'
          return delete(major,minor) if command == 'delete' || command == 'd'
        else
          return list                if command == 'list' || command == 'l'
          puts "Argument required for commmand #{command}."
          puts "imgurr --help for more information."
          return
        end
      end
def delegate ( command , major , minor ) return help unless command return no_internet unless self . internet_connection? return capture if command == 'capture' || command == 'cap' if major return upload ( major ) if command == 'upload' || command == 'up' || command == 'u' if major =~ / .*imgur \. com \/ [a-zA-Z0-9]* \. [a-zA-Z]* / major = / com \/ [a-zA-Z0-9]* / . match ( major ) . to_s . gsub ( 'com/' , '' ) end return unless valid_id major return info ( major ) if command == 'info' || command == 'i' return delete ( major , minor ) if command == 'delete' || command == 'd' else return list if command == 'list' || command == 'l' puts "Argument required for commmand #{command}." puts "imgurr --help for more information." return end end
Public: allows main access to most commands.
Public : allows main access to most commands .
# Get image ID from URL
command
<not_specific>
major
<not_specific>
minor
<not_specific>