Sha256: d4c4614e04b13a27844ad124c8b0b5638e3b00fc90bfcb33b48a5f183e9dca2d

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

module ActsAsNotifiableRedmine
  class Channel

    attr_reader :name, :identifier, :events

    def initialize(id, &block)
      @id         = id.to_sym
      @name       = @id
      @identifier = "channel_#{name}"
      @events     = []
      @target     = "#{name}"

      instance_eval(&block)
    end


    def target(target)
      @target = target
    end


    def token
      if @target.is_a?(Proc)
        "#{@name}-#{@target.call(self)}"
      else
        @target
      end
    end


    def event(name, options = {})
      new_event = Event.new(name, options)
      @events.push(new_event)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_notifiable_redmine-0.1.1 lib/acts_as_notifiable_redmine/channel.rb
acts_as_notifiable_redmine-0.1 lib/acts_as_notifiable_redmine/channel.rb