class Formulario::Field::Collection
Public Class Methods
[](type)
click to toggle source
# File lib/formulario/fields/collection.rb, line 6 def self.[](type) Class.new(self).tap { |typed_class| typed_class.fields_type = type } end
Private Class Methods
build(raw_values)
click to toggle source
# File lib/formulario/fields/collection.rb, line 30 def self.build(raw_values) new( Array(raw_values).map { |raw_value| fields_type.for(raw_value) } ) end
fields_type()
click to toggle source
# File lib/formulario/fields/collection.rb, line 37 def self.fields_type @fields_type ||= Field end
fields_type=(type)
click to toggle source
# File lib/formulario/fields/collection.rb, line 41 def self.fields_type=(type) @fields_type = type_for(type) end
Public Instance Methods
each(&block)
click to toggle source
# File lib/formulario/fields/collection.rb, line 20 def each(&block) fields.each(&block) end
exceptional?()
click to toggle source
# File lib/formulario/fields/collection.rb, line 16 def exceptional? fields.any?(&:exceptional?) end
fields()
click to toggle source
# File lib/formulario/fields/collection.rb, line 12 def fields raw_value end
values()
click to toggle source
# File lib/formulario/fields/collection.rb, line 24 def values map(&:value) end