Class: MiniSOReader
Overview
minimal implementation to read information of a shared object.
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
-
#cpu ⇒ Object
readonly
Returns the value of attribute cpu.
-
#endian ⇒ Object
readonly
Returns the value of attribute endian.
-
#file_format ⇒ Object
readonly
Returns the value of attribute file_format.
Instance Method Summary collapse
-
#initialize(filename) ⇒ MiniSOReader
constructor
A new instance of MiniSOReader.
Constructor Details
#initialize(filename) ⇒ MiniSOReader
Returns a new instance of MiniSOReader.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'ext/oci8/oraconf.rb', line 124 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
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
122 123 124 |
# File 'ext/oci8/oraconf.rb', line 122 def bits @bits end |
#cpu ⇒ Object (readonly)
Returns the value of attribute cpu.
120 121 122 |
# File 'ext/oci8/oraconf.rb', line 120 def cpu @cpu end |
#endian ⇒ Object (readonly)
Returns the value of attribute endian.
121 122 123 |
# File 'ext/oci8/oraconf.rb', line 121 def endian @endian end |
#file_format ⇒ Object (readonly)
Returns the value of attribute file_format.
119 120 121 |
# File 'ext/oci8/oraconf.rb', line 119 def file_format @file_format end |