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, endian) ⇒ Object
- #copy_fields(other) ⇒ Object
- #field_names ⇒ Object
-
#initialize(sanitizer) ⇒ SanitizedFields
constructor
A new instance of SanitizedFields.
Constructor Details
#initialize(sanitizer) ⇒ SanitizedFields
Returns a new instance of SanitizedFields.
228 229 230 231 |
# File 'lib/bindata/sanitize.rb', line 228 def initialize(sanitizer) @sanitizer = sanitizer @fields = [] end |
Instance Method Details
#[](idx) ⇒ Object
237 238 239 |
# File 'lib/bindata/sanitize.rb', line 237 def [](idx) @fields[idx] end |
#add_field(type, name, params, endian) ⇒ Object
233 234 235 |
# File 'lib/bindata/sanitize.rb', line 233 def add_field(type, name, params, endian) @fields << SanitizedField.new(@sanitizer, name, type, params, endian) end |
#copy_fields(other) ⇒ Object
245 246 247 248 |
# File 'lib/bindata/sanitize.rb', line 245 def copy_fields(other) other_fields = other.instance_variable_get(:@fields) @fields.concat(other_fields) end |
#field_names ⇒ Object
241 242 243 |
# File 'lib/bindata/sanitize.rb', line 241 def field_names @fields.collect { |field| field.name } end |