Class: BinData::SanitizedFields

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

Overview


Instance Method Summary collapse

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_namesObject



236
237
238
# File 'lib/bindata/sanitize.rb', line 236

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