Sha256: a554f4c26b9a5e3903d55b13f81c997a6d147ad9919ce7478fcf6510b1ce1c94

Contents?: true

Size: 650 Bytes

Versions: 10

Compression:

Stored size: 650 Bytes

Contents

# frozen_string_literal: true

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

      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

10 entries across 10 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.5.4 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.5.3 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.5.2 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.5.1 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.5.0 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.4.2 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.4.1 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.4.0 lib/doc_template/objects/metadata_helpers.rb
lcms-engine-0.3.1 lib/doc_template/objects/metadata_helpers.rb