Sha256: fdb16d0f892ec47d32436959b536c5ae6ee2a483c9adefa87c7fc6cfd073ea99

Contents?: true

Size: 622 Bytes

Versions: 4

Compression:

Stored size: 622 Bytes

Contents

class Gator
  module ActAsCommand

    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods

      attr_reader :definition, :parent

      def define(definition)
        @definition = definition
      end

      def parent_command=(klass)
        @parent = klass
      end

    end

    def parent
      self.class.parent
    end

    def definition
      self.class.definition
    end

    def get_subcommand(*args)
      nil
    end

    def resolve_subcommand(command, fallback=nil)
      return nil unless parent
      parent.resolve_subcommand(command, fallback)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gator-0.0.25.pre lib/gator/core/command/act_as_command.rb
gator-0.0.24.pre lib/gator/core/command/act_as_command.rb
gator-0.0.23.pre lib/gator/core/command/act_as_command.rb
gator-0.0.22.pre lib/gator/core/command/act_as_command.rb