Class: EventsManager::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/events_manager/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity, action, data) ⇒ Event

Returns a new instance of Event.



7
8
9
10
11
# File 'lib/events_manager/event.rb', line 7

def initialize(entity, action, data)
  @entity = entity
  @action = action
  @data = data
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



5
6
7
# File 'lib/events_manager/event.rb', line 5

def action
  @action
end

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/events_manager/event.rb', line 5

def data
  @data
end

#entityObject (readonly)

Returns the value of attribute entity.



5
6
7
# File 'lib/events_manager/event.rb', line 5

def entity
  @entity
end

Instance Method Details

#issue_create?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/events_manager/event.rb', line 17

def issue_create?
  entity == ::Issue && action == :create
end

#issue_relation_create?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/events_manager/event.rb', line 25

def issue_relation_create?
  entity == ::IssueRelation && action == :create
end

#issue_update?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/events_manager/event.rb', line 21

def issue_update?
  entity == ::Issue && action == :update
end

#to_sObject



13
14
15
# File 'lib/events_manager/event.rb', line 13

def to_s
  "#{entity}::#{action}|#{data.class}(#{data.id})"
end