Class: BinData::SanitizedChoices
- Inherits:
-
SanitizedParameter
- Object
- SanitizedParameter
- BinData::SanitizedChoices
- Defined in:
- lib/bindata/sanitize.rb
Overview
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(choices, hints) ⇒ SanitizedChoices
constructor
A new instance of SanitizedChoices.
Constructor Details
#initialize(choices, hints) ⇒ SanitizedChoices
Returns a new instance of SanitizedChoices.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/bindata/sanitize.rb', line 125 def initialize(choices, hints) @choices = {} choices.each_pair do |key, val| if SanitizedParameter === val prototype = val else type, param = val prototype = SanitizedPrototype.new(type, param, hints) end if key == :default @choices.default = prototype else @choices[key] = prototype end end end |
Instance Method Details
#[](key) ⇒ Object
143 144 145 |
# File 'lib/bindata/sanitize.rb', line 143 def [](key) @choices[key] end |