Class: SSHKit::CommandMap

### Home Classes Methods

### In Files

- lib/sshkit/command_map.rb

### Parent

Object

### Namespace

- CLASS SSHKit::CommandMap::CommandHash
- CLASS SSHKit::CommandMap::PrefixProvider

### Methods

- ::new
- #[]
- #[]=
- #clear
- #defaults
- #prefix

### Class/Module Index

Quicksearch

- SSHKit
- SSHKit::Backend
- SSHKit::Backend::Abstract
- SSHKit::Backend::ConnectionPool
- SSHKit::Backend::Local
- SSHKit::Backend::Netssh
- SSHKit::Backend::Netssh::Configuration
- SSHKit::Backend::Printer
- SSHKit::Backend::Skipper
- SSHKit::CommandMap
- SSHKit::CommandMap::CommandHash
- SSHKit::CommandMap::PrefixProvider
- SSHKit::Configuration
- SSHKit::Coordinator
- SSHKit::DSL
- SSHKit::Formatter
- SSHKit::Formatter::Abstract
- SSHKit::Formatter::BlackHole
- SSHKit::Formatter::Dot
- SSHKit::Formatter::Pretty
- SSHKit::Formatter::SimpleText
- SSHKit::Host
- SSHKit::HostWithPortParser
- SSHKit::HostWithUsernameAndPortParser
- SSHKit::HostWithUsernameParser
- SSHKit::IPv6HostWithPortParser
- SSHKit::LogMessage
- SSHKit::Logger
- SSHKit::Logger::SSHKit
- SSHKit::Logger::SSHKit::Logger
- SSHKit::Logger::SSHKit::Logger::Net
- SSHKit::Logger::SSHKit::Logger::Net::SSH
- SSHKit::Logger::SSHKit::Logger::Net::SSH::LogLevelShim
- SSHKit::Runner
- SSHKit::Runner::Abstract
- SSHKit::Runner::ExecuteError
- SSHKit::Runner::Group
- SSHKit::Runner::Null
- SSHKit::Runner::Parallel
- SSHKit::Runner::Sequential
- SSHKit::SimpleHostParser
- SSHKit::Utils
- SSHKit::Utils::CaptureOutputMethods
- Net
- Net::SSH
- Net::SSH::Config
- Array
- Color
- Hash
- Object

No matching classes.

# SSHKit::CommandMap

### Public Class Methods

new(value = nil) click to toggle source

    # File lib/sshkit/command_map.rb, line 36
    def initialize(value = nil)
      @map = CommandHash.new(value || defaults)
    end

### Public Instance Methods

[](command) click to toggle source

    # File lib/sshkit/command_map.rb, line 40
    def [](command)
      if prefix[command].any?
        prefixes = prefix[command].map{ |prefix| prefix.respond_to?(:call) ? prefix.call : prefix }
        prefixes = prefixes.join(" ")

        "#{prefixes} #{command}"
      else
        @map[command]
      end
    end

[]=(command, new_command) click to toggle source

    # File lib/sshkit/command_map.rb, line 55
    def []=(command, new_command)
      @map[command] = new_command
    end

clear() click to toggle source

    # File lib/sshkit/command_map.rb, line 59
    def clear
      @map = CommandHash.new(defaults)
    end

defaults() click to toggle source

    # File lib/sshkit/command_map.rb, line 63
    def defaults
      Hash.new do |hash, command|
        if %{if test time}.include? command.to_s
          hash[command] = command.to_s
        else
          hash[command] = "/usr/bin/env #{command}"
        end
      end
    end

prefix() click to toggle source

    # File lib/sshkit/command_map.rb, line 51
    def prefix
      @prefix ||= PrefixProvider.new
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.