Sha256: 50f93ce4c0a67c32eff6e3cf6a78614552d8bf527ede212e89749ebdd9385646

Contents?: true

Size: 643 Bytes

Versions: 6

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

module DocTemplate
  module Objects
    module MetadataHelpers
      SEPARATOR = /\s*[,;]\s*/

      def self.build_anchor_from(item)
        [
          item.idx,
          item.try(:template_type),
          item.try(:level),
          item.title
        ].compact.join('-').parameterize
      end

      def standard_info(standards)
        Array.wrap(standards)
          .flat_map { |x| x.to_s.split(SEPARATOR) }
          .map(&:strip)
          .reject(&:blank?)
          .uniq
          .map { |x| { description: Standard.search_by_name(x).take&.description, standard: x } }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lcms-engine-0.1.4 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.3.0 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.1.3 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.2.0 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.1.2 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.1.0 lib/doc_template/objects/metadata_helpers.rb