Sha256: 563a487b93114187aa2d205e58adbd9dae09eca35680f218a1bc3549db2c25ed
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
module Vos class Box include Shell, Marks, Vfs attr_accessor :options def initialize *args first = args.first if args.empty? @driver = Drivers::Local.new elsif first.is_a?(String) or first.is_a?(Symbol) or first.is_a?(Hash) and (args.size <= 2) if first.is_a? Hash options = first options[:host] ||= 'localhost' else options = args[1] || {} raise 'invalid arguments' unless options.is_a?(Hash) options[:host] = first.to_s end @driver = options[:host] == 'localhost' ? Drivers::Local.new(options) : Drivers::Ssh.new(options) elsif args.size == 1 @driver = first else raise 'invalid arguments' end end # # driver # attr_reader :driver def open &block driver.open &block end def close driver.close end # # Micelaneous # def inspect driver.to_s # host = options[:host] # if host == 'localhost' # '' # else # host # end end alias_method :to_s, :inspect end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vos-0.1.3 | lib/vos/box.rb |
vos-0.1.2 | lib/vos/box.rb |
vos-0.1.1 | lib/vos/box.rb |