Sha256: 0bf4cc4edef9c757e60322728383cd18740bf1b8c1c39f68269ea6f009f8349b

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

module Quickl
  class Command
    module Robustness
      include Naming
      
      # Checks that a command whose name is given exists
      # or raises a NoSuchCommand.
      def has_command!(name, referer = self.class)
        name.split(':').inject(referer){|cur,look|
          cur.const_get(command2module(look))
        }
      rescue NameError => ex
        raise NoSuchCommand, "No such command #{name}", ex.backtrace
      end
      
    end # module Robustness
  end # class Command
end # module Quickl

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quickl-0.1.1 lib/quickl/command/robustness.rb