Sha256: 9baa23c95b5ecefad8bc426ba6a94df875211315c77e6d85fc742c7b5f516374
Contents?: true
Size: 1.15 KB
Versions: 5
Compression:
Stored size: 1.15 KB
Contents
module Vos class Box include Shell, Marks, Vfs 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 : 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 # # Miscellaneous # def inspect; driver.to_s end alias_method :to_s, :inspect def host; driver.host end def local?; host == 'localhost' end class << self def local; @local ||= Box.new end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
vos-0.3.12 | lib/vos/box.rb |
vos-0.3.11 | lib/vos/box.rb |
vos-0.3.10 | lib/vos/box.rb |
vos-0.3.9 | lib/vos/box.rb |
vos-0.3.8 | lib/vos/box.rb |