Class: BinData::SanitizedChoices

Inherits:
SanitizedParameter show all
Defined in:
lib/bindata/sanitize.rb

Overview


Instance Method Summary collapse

Constructor Details

#initialize(choices, endian) ⇒ SanitizedChoices

Returns a new instance of SanitizedChoices.



103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/bindata/sanitize.rb', line 103

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

    @choices[key] = prototype
  end
end

Instance Method Details

#[](key) ⇒ Object



117
118
119
# File 'lib/bindata/sanitize.rb', line 117

def [](key)
  @choices[key]
end