Class: Swineherd::LocalFileSystem::LocalFile

Inherits:
Object
  • Object
show all
Defined in:
lib/swineherd/filesystem/localfilesystem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, mode = "r", &blk) ⇒ LocalFile

Returns a new instance of LocalFile.



55
56
57
58
59
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 55

def initialize path, mode="r", &blk
  @path   = path
  @mode   = mode
  @handle = File.open(path,mode,&blk)
end

Instance Attribute Details

#handleObject

Returns the value of attribute handle.



53
54
55
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 53

def handle
  @handle
end

#modeObject

Returns the value of attribute mode.



53
54
55
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 53

def mode
  @mode
end

#pathObject

Returns the value of attribute path.



53
54
55
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 53

def path
  @path
end

#schemeObject

Returns the value of attribute scheme.



53
54
55
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 53

def scheme
  @scheme
end

Instance Method Details

#closeObject



77
78
79
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 77

def close
  @handle.close
end

#open(path, mode = "r", &blk) ⇒ Object



61
62
63
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 61

def open path, mode="r", &blk
  initialize(path,mode,&blk)
end

#readObject



65
66
67
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 65

def read
  @handle.read
end

#readlineObject



69
70
71
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 69

def readline
  @handle.gets
end

#write(string) ⇒ Object



73
74
75
# File 'lib/swineherd/filesystem/localfilesystem.rb', line 73

def write string
  @handle.write(string)
end