Sha256: c76b53089949c94233130a7cfc1d1600baebafa46ed0de2e1ed8ffd15ce79d87

Contents?: true

Size: 936 Bytes

Versions: 8

Compression:

Stored size: 936 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.5.0 test/support/helpers/model_test_class.rb
vedeu-0.4.65 test/support/helpers/model_test_class.rb
vedeu-0.4.64 test/support/helpers/model_test_class.rb
vedeu-0.4.63 test/support/helpers/model_test_class.rb
vedeu-0.4.62 test/support/helpers/model_test_class.rb
vedeu-0.4.61 test/support/helpers/model_test_class.rb
vedeu-0.4.60 test/support/helpers/model_test_class.rb
vedeu-0.4.59 test/support/helpers/model_test_class.rb