Sha256: 894e179843c94de8404cbd497cb4c67f76542dbe7af45e300e879bb5eb34e57a

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

require 'tengine/core'

class Tengine::Core::Setting
  include Mongoid::Document
  include Tengine::Core::FindByName

  field :name, :type => String
  field :value

  validates :name, :presence => true, :uniqueness => true

  index({name: 1}, {unique: true})

  class << self
    def dsl_version
      document = where({:name => "dsl_version"}).first
      raise Mongoid::Errors::DocumentNotFound.new(Tengine::Core::Setting, "dsl_version", "dsl_version") unless document
      document.value
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tengine_core-1.2.2 lib/tengine/core/setting.rb
tengine_core-1.2.1 lib/tengine/core/setting.rb
tengine_core-1.2.0 lib/tengine/core/setting.rb
tengine_core-1.1.0 lib/tengine/core/setting.rb