Class: Hornetseye::OpenEXRInput

Inherits:
Object
  • Object
show all
Defined in:
lib/hornetseye-openexr/openexrinput.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(file) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/hornetseye-openexr/openexrinput.rb', line 26

def new( file )
  if file.is_a? File
    retval = orig_new file
  else
    file = File.new file, 'rb'
    retval = orig_new file
  end
  class << retval
    def file=( file )
      @file = file
    end
  end
  # Prevent garbage-collector from closing file.
  retval.file = file
  retval
end

.orig_newObject



24
# File 'lib/hornetseye-openexr/openexrinput.rb', line 24

alias_method :orig_new, :new

Instance Method Details

#closeObject



45
46
47
48
# File 'lib/hornetseye-openexr/openexrinput.rb', line 45

def close
  @file.close if @file
  @file = nil
end