Module: Puffer::Extensions::Array

Defined in:
lib/puffer/extensions/core.rb

Instance Method Summary collapse

Instance Method Details

#to_fieldsetObject



31
32
33
# File 'lib/puffer/extensions/core.rb', line 31

def to_fieldset
  Puffer::FieldSet.new.concat self
end

#to_includesObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/puffer/extensions/core.rb', line 35

def to_includes
  map do |field|
    sections = field.split('.').map(&:to_sym)
    hash = sections.pop
    sections.reverse_each do |section|
      hash = {section => hash}
    end
    hash
  end
end