Sha256: cdadd0e2a308813b84bb436dcdaf5124db34a8d493bdb822654d5c491f66897e

Contents?: true

Size: 1.04 KB

Versions: 33

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'quby/questionnaires/entities/definition'

module Quby
  module Questionnaires
    module Repos
      class Base
        def all
          keys.map { |key| find(key) }
        end

        def find(key)
          fail NotImplementedError
        end

        def exists?(key)
          fail NotImplementedError
        end

        def timestamp(key)
          fail NotImplementedError
        end

        def create!(key, sourcecode)
          fail(DuplicateQuestionnaire, key) if exists?(key)
          store!(key, sourcecode)
          find(key)
        end

        def update!(key, sourcecode)
          fail(QuestionnaireNotFound, key) unless exists?(key)
          store!(key, sourcecode)
          find(key)
        end

        private

        def store!(key, sourcecode)
          fail NotImplementedError
        end

        def entity(key, sourcecode, timestamp, path)
          Entities::Definition.new(key: key, sourcecode: sourcecode, timestamp: timestamp, path: path)
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
quby-5.6.5 lib/quby/questionnaires/repos/base.rb
quby-5.6.3 lib/quby/questionnaires/repos/base.rb
quby-5.6.2 lib/quby/questionnaires/repos/base.rb
quby-5.6.1 lib/quby/questionnaires/repos/base.rb
quby-5.6.0 lib/quby/questionnaires/repos/base.rb
quby-5.5.0 lib/quby/questionnaires/repos/base.rb
quby-5.4.0 lib/quby/questionnaires/repos/base.rb
quby-5.3.1 lib/quby/questionnaires/repos/base.rb
quby-5.3.0 lib/quby/questionnaires/repos/base.rb
quby-5.2.0 lib/quby/questionnaires/repos/base.rb
quby-5.1.3 lib/quby/questionnaires/repos/base.rb
quby-5.1.2 lib/quby/questionnaires/repos/base.rb
quby-5.1.1 lib/quby/questionnaires/repos/base.rb
quby-5.1.0 lib/quby/questionnaires/repos/base.rb
quby-5.0.5 lib/quby/questionnaires/repos/base.rb
quby-5.0.4 lib/quby/questionnaires/repos/base.rb
quby-5.0.3 lib/quby/questionnaires/repos/base.rb
quby-5.0.2 lib/quby/questionnaires/repos/base.rb
quby-5.0.1 lib/quby/questionnaires/repos/base.rb
quby-5.0.0 lib/quby/questionnaires/repos/base.rb