Sha256: cc7f17ae0e1e54ee3492c455873257593a0a77359a4cf69f60a6114d9c0878db

Contents?: true

Size: 1.32 KB

Versions: 10

Compression:

Stored size: 1.32 KB

Contents

module Vedeu

  module Repositories

    module DSL

      class ModelTestClass

        include Vedeu::DSL::Presentation

        def initialize(model, client = nil)
          @model  = model
          @client = client
        end

        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
        {
          colour:     {},
          name:       '',
          repository: Vedeu::Repositories::RepositoryTestModule,
          style:      [],
        }
      end

    end # ModelTestClass

  end # Repositories

end # Vedeu

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vedeu-0.6.20 test/support/helpers/model_test_class.rb
vedeu-0.6.19 test/support/helpers/model_test_class.rb
vedeu-0.6.18 test/support/helpers/model_test_class.rb
vedeu-0.6.17 test/support/helpers/model_test_class.rb
vedeu-0.6.16 test/support/helpers/model_test_class.rb
vedeu-0.6.15 test/support/helpers/model_test_class.rb
vedeu-0.6.14 test/support/helpers/model_test_class.rb
vedeu-0.6.13 test/support/helpers/model_test_class.rb
vedeu-0.6.12 test/support/helpers/model_test_class.rb
vedeu-0.6.11 test/support/helpers/model_test_class.rb