Sha256: a9e7ef595419c61ff0346e1861be206825dbf3f301cc73f28799ef2d4db80274

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 Bytes

Contents

module Controll
  # used to register commands for a controller
  class Commander
    # makes #command_method available
    extend Imperator::Command::MethodFactory

    attr_reader :initiator, :options

    def initialize initiator, options = {}
      @initiator = initiator
      @options = options
    end

    def command name, *args
      send "#{name}_command", *args
    end

    def command! name, *args
      command(name, *args).perform
    end
    alias_method :use_command, :command!
    alias_method :perform_command, :command!

    alias_method :controller, :initiator

    class << self
      def initiator_methods *names
        delegate names, to: :initiator
      end    
      alias_method :controller_methods, :initiator_methods
    end
  end
end

module Commanders
  Commander = Controll::Commander
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
controll-0.3.2 lib/controll/commander.rb
controll-0.3.1 lib/controll/commander.rb
controll-0.3.0 lib/controll/commander.rb