Sha256: b6df092af5de780ca078c1cc485708dd2138a3fadd8f83f1d3a8a08ad6f486c4

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

module Vedeu
  class Command
    attr_accessor :attributes, :name, :entity, :keyword, :keypress

    def initialize(attributes = {})
      @attributes = attributes || {}
      @name       = attributes[:name]
      @entity     = attributes[:entity]
      @keyword    = attributes.fetch(:options, {}).fetch(:keyword, '')
      @keypress   = attributes.fetch(:options, {}).fetch(:keypress, '')
    end

    def execute(args = [])
      executable.call(*args)
    end

    def executable
      proc { |*args| attributes[:entity].dispatch(*args) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.0.23 lib/vedeu/repository/command.rb
vedeu-0.0.22 lib/vedeu/repository/command.rb