Sha256: 3b154c40c865006aa1c933c37b9f827ac3676348a290022ab52f38768829aacc

Contents?: true

Size: 435 Bytes

Versions: 2

Compression:

Stored size: 435 Bytes

Contents

# frozen_string_literal: true

module ModsDisplay
  class Form < Field
    def fields
      return [] unless form_fields.present?

      [
        ModsDisplay::Values.new(
          label: I18n.t('mods_display.form'),
          values: form_fields.map(&:text).uniq { |x| x.downcase.gsub(/\s/, '').gsub(/[[:punct:]]/, '') }
        )
      ]
    end

    private

    def form_fields
      @values.map(&:form).flatten
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mods_display-1.0.0 lib/mods_display/fields/form.rb
mods_display-1.0.0.alpha5 lib/mods_display/fields/form.rb