Class: BinData::SanitizedFields

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

Overview


Instance Method Summary collapse

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_namesObject



241
242
243
# File 'lib/bindata/sanitize.rb', line 241

def field_names
  @fields.collect { |field| field.name }
end