Class: BinData::SanitizedChoices
- Inherits:
-
SanitizedParameter
- Object
- SanitizedParameter
- BinData::SanitizedChoices
- Defined in:
- lib/bindata/sanitize.rb
Overview
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(choices, endian) ⇒ SanitizedChoices
constructor
A new instance of SanitizedChoices.
Constructor Details
#initialize(choices, endian) ⇒ SanitizedChoices
Returns a new instance of SanitizedChoices.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/bindata/sanitize.rb', line 112 def initialize(choices, endian) @choices = {} choices.each_pair do |key, val| if SanitizedParameter === val prototype = val else type, param = val prototype = SanitizedPrototype.new(type, param, endian) end if key == :default @choices.default = prototype else @choices[key] = prototype end end end |
Instance Method Details
#[](key) ⇒ Object
130 131 132 |
# File 'lib/bindata/sanitize.rb', line 130 def [](key) @choices[key] end |