Sha256: e8c1bd0da7f73868243f1cea1bc3ed876eef372bb9c75309b368c5a0cab9b2f1

Contents?: true

Size: 954 Bytes

Versions: 10

Compression:

Stored size: 954 Bytes

Contents

# frozen_string_literal: true

# TODO: Move to lt-lcms gem
module Lt
  module Lcms
    module Metadata
      class BaseService
        class << self
          attr_reader :activity_metadata, :errors, :metadata, :section_metadata

          def materials_metadata
            raise NotImplementedError
          end

          def options_for(context)
            raise 'Metadata is empty' unless metadata.present?

            {}.tap do |result|
              result.merge!(lesson_options) unless material?
              result[:context_type] = context
            end
          end

          def parse(_content, *args)
            @errors = []
            @options = args.extract_options!
          end

          protected

          attr_reader :options

          def lesson_options
            raise NotImplementedError
          end

          def material?
            options&.[](:material)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.5.4 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.5.3 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.5.2 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.5.1 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.5.0 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.4.2 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.4.1 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.4.0 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.3.1 lib/lt/lcms/metadata/base_service.rb