Sha256: 17e812838896c2a5eef80f2838ad147a2f14a4b3fede455362768a715ef0c2f1
Contents?: true
Size: 1.12 KB
Versions: 11
Compression:
Stored size: 1.12 KB
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", :child_key => [:project_id] validates_is_unique :name, :scope => :project_id validates_present :project_id def self.available @@_notifiers ||= {} @@_notifiers end def self.register(klass) raise ArgumentError unless valid?(klass) available[klass.to_s.split(":").last] = klass end def self.valid?(notifier) notifier.respond_to?(:to_haml) && notifier.respond_to?(:notify_of_build) && notifier != Notifier::Base end private_class_method :valid? 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
11 entries across 11 versions & 5 rubygems