Sha256: 9c4002d734a7075a5ea86722887b37e263c21e0ffc7d4012656f2396dde9fecf

Contents?: true

Size: 1.29 KB

Versions: 9

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Vedeu

  module Repositories

    module DSL

      class ModelTestClass

        include Vedeu::DSL
        include Vedeu::DSL::Presentation

        protected

        attr_reader :model

      end # DSL

    end # ModelTestClass

    module RepositoryTestModule

      extend self

      def by_name(name)
        model
      end

      # The real repository stores the model and returns it.
      def store(model)
        model
      end

      private

      # A storage solution that uses memory to persist models.
      def in_memory
        {}
      end

    end # RepositoryTestModule

    class ModelTestClass

      include Vedeu::Repositories::Model
      include Vedeu::Presentation

      attr_accessor :background, :colour, :name, :style

      def initialize(attributes = {})
        defaults.merge!(attributes).each do |key, value|
          instance_variable_set("@#{key}", value)
        end
      end

      private

      # Returns the default options/attributes for this class.
      #
      def defaults
        {
          client:     nil,
          colour:     {},
          name:       '',
          repository: Vedeu::Repositories::RepositoryTestModule,
          style:      [],
        }
      end

    end # ModelTestClass

  end # Repositories

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.8.9 test/support/helpers/model_test_class.rb
vedeu-0.8.8 test/support/helpers/model_test_class.rb
vedeu-0.8.7 test/support/helpers/model_test_class.rb
vedeu-0.8.6 test/support/helpers/model_test_class.rb
vedeu-0.8.5 test/support/helpers/model_test_class.rb
vedeu-0.8.4 test/support/helpers/model_test_class.rb
vedeu-0.8.3 test/support/helpers/model_test_class.rb
vedeu-0.8.2 test/support/helpers/model_test_class.rb
vedeu-0.8.1 test/support/helpers/model_test_class.rb