Sha256: 3e8de3aa918baa3cb9a7045e7c7bec4f95d474e17f613c53045eadf0bc913c5b

Contents?: true

Size: 625 Bytes

Versions: 20

Compression:

Stored size: 625 Bytes

Contents

module Commander
  class Command
    attr_accessor :block

    class Options
      
      def __merge(params)
        new_options = self.__clone
        new_options.__hash__.merge!(params)
        new_options
      end
      
      def __clone
        new_options = Options.new
        new_options.__hash__.merge!(__hash__)
        new_options
      end
      
    end

    def invoke(args=[], options=nil)
      options = options ? options.__clone : Options.new
      self.block.call(args, options)
    end
    
    def task_action(*args, &block)
      when_called(*args, &block)
      self.block = block
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
maglove-0.8.1 lib/ext/commander/command.rb
maglove-0.8.0 lib/ext/commander/command.rb
maglove-0.7.2 lib/ext/commander/command.rb
maglove-0.7.1 lib/ext/commander/command.rb
maglove-0.7.0 lib/ext/commander/command.rb
maglove-0.6.6 lib/ext/commander/command.rb
maglove-0.6.5 lib/ext/commander/command.rb
maglove-0.6.4 lib/ext/commander/command.rb
maglove-0.6.3 lib/ext/commander/command.rb
maglove-0.6.2 lib/ext/commander/command.rb
maglove-0.6.1 lib/ext/commander/command.rb
maglove-0.6.0 lib/ext/commander/command.rb
maglove-0.5.9 lib/ext/commander/command.rb
maglove-0.5.8 lib/ext/commander/command.rb
maglove-0.5.7 lib/ext/commander/command.rb
maglove-0.5.5 lib/ext/commander/command.rb
maglove-0.5.4 lib/ext/commander/command.rb
maglove-0.5.2 lib/ext/commander/command.rb
maglove-0.5.1 lib/ext/commander/command.rb
maglove-0.5.0 lib/ext/commander/command.rb