Class: ActsAsNotifiableRedmine::Channel
- Inherits:
-
Object
- Object
- ActsAsNotifiableRedmine::Channel
- Defined in:
- lib/acts_as_notifiable_redmine/channel.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #event(name, options = {}) ⇒ Object
-
#initialize(id, &block) ⇒ Channel
constructor
A new instance of Channel.
- #target(target) ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(id, &block) ⇒ Channel
Returns a new instance of Channel.
6 7 8 9 10 11 12 13 14 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 6 def initialize(id, &block) @id = id.to_sym @name = @id @identifier = "channel_#{name}" @events = [] @target = "#{name}" instance_eval(&block) end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
4 5 6 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 4 def events @events end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 4 def identifier @identifier end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 4 def name @name end |
Instance Method Details
#event(name, options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 31 def event(name, = {}) new_event = Event.new(name, ) @events.push(new_event) end |
#target(target) ⇒ Object
17 18 19 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 17 def target(target) @target = target end |
#token ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/acts_as_notifiable_redmine/channel.rb', line 22 def token if @target.is_a?(Proc) "#{@name}-#{@target.call(self)}" else @target end end |