Module: Docker::Compose::ShellPrinter

Defined in:
lib/docker/compose/shell_printer.rb,
lib/docker/compose/shell_printer/fish.rb,
lib/docker/compose/shell_printer/posix.rb

Defined Under Namespace

Classes: Fish, Posix

Class Method Summary collapse

Class Method Details

.newObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/docker/compose/shell_printer.rb', line 6

def self.new
  shell = Etc.getpwuid(Process.uid).shell
  basename = File.basename(shell)

  # Crappy titleize (bash -> Bash)
  basename[0] = basename[0].upcase

  # Find adapter class named after shell; default to posix if nothing found
  klass = begin
            const_get(basename.to_sym)
          rescue
            Posix
          end

  klass.new
end