Class: MiniSOReader

Inherits:
Object
  • 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

Returns a new instance of MiniSOReader.



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
129
130
131
132
133
134
135
# File 'ext/oci8/oraconf.rb', line 103

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], file_header[1])
    end
  ensure
    f.close
  end
end

Instance Attribute Details

#bitsObject (readonly)

Returns the value of attribute bits.



101
102
103
# File 'ext/oci8/oraconf.rb', line 101

def bits
  @bits
end

#cpuObject (readonly)

Returns the value of attribute cpu.



99
100
101
# File 'ext/oci8/oraconf.rb', line 99

def cpu
  @cpu
end

#endianObject (readonly)

Returns the value of attribute endian.



100
101
102
# File 'ext/oci8/oraconf.rb', line 100

def endian
  @endian
end

#file_formatObject (readonly)

Returns the value of attribute file_format.



98
99
100
# File 'ext/oci8/oraconf.rb', line 98

def file_format
  @file_format
end