Class: Bullet::Notification::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bullet/notification/base.rb

Direct Known Subclasses

CounterCache, NPlusOneQuery, UnusedEagerLoading

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_class, associations, path = nil) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
# File 'lib/bullet/notification/base.rb', line 7

def initialize( base_class, associations, path = nil )
  @base_class = base_class
  @associations = associations.is_a?( Array ) ? associations : [ associations ]
  @path = path
end

Instance Attribute Details

#associationsObject (readonly)

Returns the value of attribute associations.



5
6
7
# File 'lib/bullet/notification/base.rb', line 5

def associations
  @associations
end

#base_classObject (readonly)

Returns the value of attribute base_class.



5
6
7
# File 'lib/bullet/notification/base.rb', line 5

def base_class
  @base_class
end

#notifierObject

Returns the value of attribute notifier.



4
5
6
# File 'lib/bullet/notification/base.rb', line 4

def notifier
  @notifier
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/bullet/notification/base.rb', line 5

def path
  @path
end

Instance Method Details

#bodyObject



16
17
# File 'lib/bullet/notification/base.rb', line 16

def body
end

#body_with_callerObject



19
20
21
# File 'lib/bullet/notification/base.rb', line 19

def body_with_caller
  body
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/bullet/notification/base.rb', line 39

def eql?( other )
  klazz_associations_str == other.klazz_associations_str
end

#full_noticeObject



27
28
29
# File 'lib/bullet/notification/base.rb', line 27

def full_notice
  @full_notice ||= title + "\n" + body_with_caller
end

#hashObject



43
44
45
# File 'lib/bullet/notification/base.rb', line 43

def hash
  klazz_associations_str.hash
end

#notify_inlineObject



31
32
33
# File 'lib/bullet/notification/base.rb', line 31

def notify_inline
  self.notifier.inline_notify( self.full_notice )
end

#notify_out_of_channelObject



35
36
37
# File 'lib/bullet/notification/base.rb', line 35

def notify_out_of_channel
  self.notifier.out_of_channel_notify( self.full_notice )
end

#standard_noticeObject



23
24
25
# File 'lib/bullet/notification/base.rb', line 23

def standard_notice
  @standard_notifice ||= title + "\n" + body
end

#titleObject



13
14
# File 'lib/bullet/notification/base.rb', line 13

def title
end