Sha256: 7ec8b56e05df0b64568b956a531bbb9221ac42ba85d3e5333da73fc6423b90ce

Contents?: true

Size: 656 Bytes

Versions: 4

Compression:

Stored size: 656 Bytes

Contents

module OpenTox

  # create default OpenTox classes
  # provides Mongoid's query and persistence methods
  # http://mongoid.org/en/mongoid/docs/persistence.html
  # http://mongoid.org/en/mongoid/docs/querying.html
  CLASSES.each do |klass|
    c = Class.new do
      include OpenTox
      include Mongoid::Document
      include Mongoid::Timestamps
      store_in collection: klass.downcase.pluralize
      field :name,  type: String
      field :source,  type: String
      field :warnings, type: Array, default: []

      def warn warning
        $logger.warn warning
        warnings << warning
      end
    end
    OpenTox.const_set klass,c
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lazar-1.1.3 lib/opentox.rb
lazar-1.1.0 lib/opentox.rb
lazar-1.0.1 lib/opentox.rb
lazar-1.0.0 lib/opentox.rb