Module: External::Patches::Ruby18Io

Defined in:
lib/external/patches/ruby_1_8_io.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#generic_modeObject (readonly)

Returns the value of attribute generic_mode.



4
5
6
# File 'lib/external/patches/ruby_1_8_io.rb', line 4

def generic_mode
  @generic_mode
end

Class Method Details

.extended(base) ⇒ Object



6
7
8
# File 'lib/external/patches/ruby_1_8_io.rb', line 6

def self.extended(base)
  base.instance_variable_set(:@generic_mode, Utils.mode(base))
end

Instance Method Details

#flushObject



10
11
12
# File 'lib/external/patches/ruby_1_8_io.rb', line 10

def flush
  super unless generic_mode == "r"
end

#fsyncObject



14
15
16
# File 'lib/external/patches/ruby_1_8_io.rb', line 14

def fsync
  super unless generic_mode == "r"
end

#quick_compare(another) ⇒ Object

Quick comparision with another IO. Returns true if another == self, or if both are file-type IOs and their paths are equal.



21
22
23
24
25
26
# File 'lib/external/patches/ruby_1_8_io.rb', line 21

def quick_compare(another)
  self == another || (
    (self.kind_of?(File) || self.kind_of?(Tempfile)) && 
    (another.kind_of?(File) || another.kind_of?(Tempfile)) && 
    self.path == another.path)
end