Class: MiniSOReader

Inherits:
Object show all
Defined in:
ext/oci8/oraconf.rb

Overview

minimal implementation to read information of a shared object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ MiniSOReader



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'ext/oci8/oraconf.rb', line 96

def initialize(filename)
  f = open(filename, 'rb')
  begin
    case file_header = f.read(2)
    when "\177E"
      # Linux, Solaris and HP-UX(64-bit)
      read_elf(f) if f.read(2) == 'LF'
    when "MZ"
      # Windows
      read_pe(f)
    when "\x02\x10"
      # HP-UX PA-RISC1.1
      read_parisc(f)
    when "\xfe\xed"
      # Big-endian Mach-O File
      read_mach_o_be(f)
    when "\xce\xfa"
      # 32-bit Little-endian Mach-O File
      read_mach_o_le(f, 32)
    when "\xcf\xfa"
      # 64-bit Little-endian Mach-O File
      read_mach_o_le(f, 64)
    when "\xca\xfe"
      # Universal binary
      read_mach_o_unversal(f)
    else
      # AIX and Tru64
      raise format("unknown file header: %02x %02x", file_header[0].to_i, file_header[1].to_i)
    end
  ensure
    f.close
  end
end

Instance Attribute Details

#bitsObject (readonly)

Returns the value of attribute bits.



94
95
96
# File 'ext/oci8/oraconf.rb', line 94

def bits
  @bits
end

#cpuObject (readonly)

Returns the value of attribute cpu.



92
93
94
# File 'ext/oci8/oraconf.rb', line 92

def cpu
  @cpu
end

#endianObject (readonly)

Returns the value of attribute endian.



93
94
95
# File 'ext/oci8/oraconf.rb', line 93

def endian
  @endian
end

#file_formatObject (readonly)

Returns the value of attribute file_format.



91
92
93
# File 'ext/oci8/oraconf.rb', line 91

def file_format
  @file_format
end