Sha256: eefbbdba11147df0f8a7fb2e1144835e77cb7b7d109cd570b684864551c05cb5

Contents?: true

Size: 425 Bytes

Versions: 5

Compression:

Stored size: 425 Bytes

Contents

require 'virtus'

module Vedeu
  class Command
    include Virtus.model

    attribute :name,      String
    attribute :entity,    Class
    attribute :keyword,   String, default: ''
    attribute :keypress,  String, default: ''
    attribute :arguments, Array,  default: []

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

    def executable
      proc { |*args| entity.dispatch(*args) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.0.30 lib/vedeu/models/command.rb
vedeu-0.0.29 lib/vedeu/models/command.rb
vedeu-0.0.28 lib/vedeu/models/command.rb
vedeu-0.0.27 lib/vedeu/models/command.rb
vedeu-0.0.26 lib/vedeu/models/command.rb