Sha256: 53de99f2b531c3c2c2d2c6ff6f978336da32f6b6bb72305269251b1e37d85d3f

Contents?: true

Size: 1008 Bytes

Versions: 14

Compression:

Stored size: 1008 Bytes

Contents

require 'vedeu/repositories/model'
require 'vedeu/output/presentation'

module Vedeu

  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::Model
    include Vedeu::Presentation

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

    def initialize(attributes = {})
      @attributes = defaults.merge!(attributes)

      @attributes.each { |key, value| instance_variable_set("@#{key}", value) }
    end

    private

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

  end # ModelTestClass

end # Vedeu

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vedeu-0.4.58 test/support/helpers/model_test_class.rb
vedeu-0.4.57 test/support/helpers/model_test_class.rb
vedeu-0.4.56 test/support/helpers/model_test_class.rb
vedeu-0.4.55 test/support/helpers/model_test_class.rb
vedeu-0.4.54 test/support/helpers/model_test_class.rb
vedeu-0.4.53 test/support/helpers/model_test_class.rb
vedeu-0.4.52 test/support/helpers/model_test_class.rb
vedeu-0.4.51 test/support/helpers/model_test_class.rb
vedeu-0.4.50 test/support/helpers/model_test_class.rb
vedeu-0.4.49 test/support/helpers/model_test_class.rb
vedeu-0.4.48 test/support/helpers/model_test_class.rb
vedeu-0.4.47 test/support/helpers/model_test_class.rb
vedeu-0.4.46 test/support/helpers/model_test_class.rb
vedeu-0.4.45 test/support/helpers/model_test_class.rb