Class: BinData::SanitizedFields
- Inherits:
-
SanitizedParameter
- Object
- SanitizedParameter
- BinData::SanitizedFields
- Defined in:
- lib/bindata/sanitize.rb
Overview
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #add_field(type, name, params) ⇒ Object
- #field_names ⇒ Object
-
#initialize(sanitizer, endian) ⇒ SanitizedFields
constructor
A new instance of SanitizedFields.
Constructor Details
#initialize(sanitizer, endian) ⇒ SanitizedFields
Returns a new instance of SanitizedFields.
220 221 222 223 224 |
# File 'lib/bindata/sanitize.rb', line 220 def initialize(sanitizer, endian) @sanitizer = sanitizer @endian = endian @fields = [] end |
Instance Method Details
#[](idx) ⇒ Object
232 233 234 |
# File 'lib/bindata/sanitize.rb', line 232 def [](idx) @fields[idx] end |
#add_field(type, name, params) ⇒ Object
226 227 228 229 230 |
# File 'lib/bindata/sanitize.rb', line 226 def add_field(type, name, params) @sanitizer.with_endian(@endian) do @fields << SanitizedField.new(@sanitizer, name, type, params) end end |
#field_names ⇒ Object
236 237 238 |
# File 'lib/bindata/sanitize.rb', line 236 def field_names @fields.collect { |field| field.name } end |