Class: BinStruct::Int16Enum
Overview
Enumeration on 2-byte integer. See Enum.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Enum
Attributes inherited from Int
#default, #endian, #value, #width
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Int16Enum
constructor
A new instance of Int16Enum.
Methods inherited from Enum
#format_inspect, #to_human, #value=
Methods inherited from Int
#format_inspect, #from_human, #nbits, #read, #sz, #to_f, #to_i, #to_s
Methods included from Structable
#format_inspect, #read, #sz, #to_human, #to_s, #type_name
Constructor Details
#initialize(options = {}) ⇒ Int16Enum
Returns a new instance of Int16Enum.
112 113 114 115 116 117 118 |
# File 'lib/bin_struct/enum.rb', line 112 def initialize( = {}) opts = .slice(:enum, :endian, :default, :value) opts[:endian] ||= :big opts[:width] = 2 super(opts) @packstr = { big: 'n', little: 'v' } end |