Class: Mercurial::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/mercurial-ruby/command.rb

Overview

This class represents a shell command. You probably don’t want to deal with this yourself, use the Shell class instead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, options = {}) ⇒ Command

Returns a new instance of Command.



15
16
17
18
19
20
# File 'lib/mercurial-ruby/command.rb', line 15

def initialize(cmd, options={})
  @command    = cmd
  @repository = options[:repository]
  @use_cache  = options[:cache].nil? || options[:cache] == false ? false : true
  @timeout    = options[:timeout] ? options[:timeout].to_i : global_execution_timeout.to_i
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



13
14
15
# File 'lib/mercurial-ruby/command.rb', line 13

def command
  @command
end

#repositoryObject

Returns the value of attribute repository.



13
14
15
# File 'lib/mercurial-ruby/command.rb', line 13

def repository
  @repository
end

#timeoutObject

Returns the value of attribute timeout.



13
14
15
# File 'lib/mercurial-ruby/command.rb', line 13

def timeout
  @timeout
end

#use_cacheObject

Returns the value of attribute use_cache.



13
14
15
# File 'lib/mercurial-ruby/command.rb', line 13

def use_cache
  @use_cache
end

Instance Method Details

#executeObject



22
23
24
25
26
27
28
# File 'lib/mercurial-ruby/command.rb', line 22

def execute
  if cache_commands?
    execute_with_caching
  else
    execute_without_caching
  end      
end