Class: FFI::Chm::Struct::System
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- FFI::Chm::Struct::System
show all
- Defined in:
- lib/ffi-chm/struct/system.rb
Defined Under Namespace
Classes: Code3, Code4, Code6, NoRecordError, SystemRecord
Constant Summary
collapse
- LCID2ENCODING =
{
1041 => "CP932", 2052 => "CP936" }
Instance Method Summary
collapse
Instance Method Details
#encoding ⇒ Object
23
24
25
|
# File 'lib/ffi-chm/struct/system.rb', line 23
def encoding
LCID2ENCODING[self.record(4).data.lcid.to_i] || "CP1252" end
|
#record(code) ⇒ Object
12
13
14
15
16
|
# File 'lib/ffi-chm/struct/system.rb', line 12
def record(code)
@memo ||= Hash[*records.map{|v|[v.code.to_i, v]}.flatten]
raise NoRecordError, "/#SYSTEM has no record code:#{code}" unless @memo.has_key? code
@memo[code]
end
|