class BinData::SanitizedFields
Public Class Methods
new(hints, base_fields = nil)
click to toggle source
# File lib/bindata/sanitize.rb, line 75 def initialize(hints, base_fields = nil) @hints = hints if base_fields @fields = base_fields.raw_fields else @fields = [] end end
Public Instance Methods
[](idx)
click to toggle source
# File lib/bindata/sanitize.rb, line 94 def [](idx) @fields[idx] end
add_field(type, name, params)
click to toggle source
# File lib/bindata/sanitize.rb, line 84 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 118 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 126 def any_field_has_parameter?(parameter) @fields.any? { |f| f.has_parameter?(parameter) } end
each(&block)
click to toggle source
# File lib/bindata/sanitize.rb, line 106 def each(&block) @fields.each(&block) end
empty?()
click to toggle source
# File lib/bindata/sanitize.rb, line 98 def empty? @fields.empty? end
field_name?(name)
click to toggle source
# File lib/bindata/sanitize.rb, line 114 def field_name?(name) @fields.detect { |f| f.name_as_sym == name.to_sym } end
field_names()
click to toggle source
# File lib/bindata/sanitize.rb, line 110 def field_names @fields.collect(&:name_as_sym) end
length()
click to toggle source
# File lib/bindata/sanitize.rb, line 102 def length @fields.length end
no_field_names_blank?()
click to toggle source
# File lib/bindata/sanitize.rb, line 122 def no_field_names_blank? @fields.all? { |f| f.name != nil } end
raw_fields()
click to toggle source
# File lib/bindata/sanitize.rb, line 90 def raw_fields @fields.dup end