Sha256: 3c768de7426708dedd22dfc809a5c87434682b4783bf9005033f6f9769ff57bb
Contents?: true
Size: 1005 Bytes
Versions: 2
Compression:
Stored size: 1005 Bytes
Contents
module Termvana class Command attr_accessor :request, :environment def initialize(environment, request) @request = request @environment = environment end def finish if !self.class.response || self.class.response == :none respond_with :null end end def respond_with(opts = {}) if opts == :null environment.send_message Termvana::Response.new elsif data = opts.delete(:text) environment.send_message Termvana::Response.new(:message => data) elsif data = opts.delete(:error) environment.send_message Termvana::Response.new(:message => data, :type => :error) end end def self.type(arg = false) @type = arg if arg @type end def self.response(arg = false) @response = arg if arg @response end def self.name(arg = false) @name = arg if arg @name end def self.match?(request) self.name.match(/^#{request[0]}$/) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
termvana-0.2.0.beta2 | lib/termvana/app/models/command.rb |
termvana-0.2.0.beta1 | lib/termvana/app/models/command.rb |