Sha256: 7039831164323a9fe807d633cbd846066f1a013287c78efe2a226c9345206175

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

require File.dirname(__FILE__) + "/notifier/base"

module Integrity
  class Notifier
    include DataMapper::Resource

    property :id,      Integer,  :serial => true
    property :name,    String,   :nullable => false
    property :enabled, Boolean,  :nullable => false, :default  => false
    property :config,  Yaml,     :nullable => false, :lazy => false

    belongs_to :project, :class_name => "Integrity::Project"

    validates_is_unique :name, :scope => :project_id
    validates_present :project_id

    def self.register(klass)
      Integrity.register_notifier(klass)
    end

    def self.available
      Integrity.notifiers
    end

    def notify_of_build(build)
      to_const.notify_of_build(build, config)
    end

    private
      def to_const
        self.class.available[name]
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imbriaco-integrity-0.1.9.2.1 lib/integrity/notifier.rb
imbriaco-integrity-0.1.9.2 lib/integrity/notifier.rb