Sha256: 2c945e40f743306d90c8fb40e0c210a73e90d2322f15801be8407504394d5090
Contents?: true
Size: 757 Bytes
Versions: 5
Compression:
Stored size: 757 Bytes
Contents
class Ghn class Command def self.commands ['list'] end attr_reader :command attr_reader :args def initialize(argv) @argv = argv @valid = false process! end def process! @command = @argv.first if self.class.commands.include?(@command) @valid = true @args = @argv.drop(1) else @valid = false end end def valid? !!@valid end def print_invalid if @command.nil? || @command.empty? print_empty_command else print_invalid_command end end def print_empty_command puts "** No command" end def print_invalid_command puts "** Invalid command `#{@command}`" end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ghn-0.1.0 | lib/ghn/command.rb |
ghn-0.0.5 | lib/ghn/command.rb |
ghn-0.0.4 | lib/ghn/command.rb |
ghn-0.0.3 | lib/ghn/command.rb |
ghn-0.0.2 | lib/ghn/command.rb |