class BinData::SanitizedFields

Attributes

fields[R]

Public Class Methods

new(hints) click to toggle source
# File lib/bindata/sanitize.rb, line 75
def initialize(hints)
  @fields = []
  @hints  = hints
end

Public Instance Methods

[](idx) click to toggle source
# File lib/bindata/sanitize.rb, line 87
def [](idx)
  @fields[idx]
end
add_field(type, name, params) click to toggle source
# File lib/bindata/sanitize.rb, line 81
def add_field(type, name, params)
  name = nil if name == ""

  @fields << SanitizedField.new(name, type, params, @hints)
end
all_field_names_blank?() click to toggle source
# File lib/bindata/sanitize.rb, line 111
def all_field_names_blank?
  @fields.all? { |f| f.name == nil }
end
any_field_has_parameter?(parameter) click to toggle source
# File lib/bindata/sanitize.rb, line 119
def any_field_has_parameter?(parameter)
  @fields.any? { |f| f.has_parameter?(parameter) }
end
copy_fields(other) click to toggle source
# File lib/bindata/sanitize.rb, line 123
def copy_fields(other)
  @fields.concat(other.fields)
end
each(&block) click to toggle source
# File lib/bindata/sanitize.rb, line 99
def each(&block)
  @fields.each(&block)
end
empty?() click to toggle source
# File lib/bindata/sanitize.rb, line 91
def empty?
  @fields.empty?
end
field_names() click to toggle source
# File lib/bindata/sanitize.rb, line 103
def field_names
  @fields.collect { |field| field.name_as_sym }
end
has_field_name?(name) click to toggle source
# File lib/bindata/sanitize.rb, line 107
def has_field_name?(name)
  @fields.detect { |f| f.name_as_sym == name.to_sym }
end
length() click to toggle source
# File lib/bindata/sanitize.rb, line 95
def length
  @fields.length
end
no_field_names_blank?() click to toggle source
# File lib/bindata/sanitize.rb, line 115
def no_field_names_blank?
  @fields.all? { |f| f.name != nil }
end