Sha256: d1ea60461391c1a9d9488d91930a285adef57a9dee38d5ffea7ec53b27a36242

Contents?: true

Size: 920 Bytes

Versions: 6

Compression:

Stored size: 920 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, :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)
            @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

6 entries across 6 versions & 1 rubygems

Version Path
lcms-engine-0.1.4 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.3.0 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.1.3 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.2.0 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.1.2 lib/lt/lcms/metadata/base_service.rb
lcms-engine-0.1.0 lib/lt/lcms/metadata/base_service.rb