Module: Pushable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/pushable.rb,
lib/pushable/railtie.rb,
lib/pushable/version.rb,
lib/pushable/acts_as_pushable.rb
Defined Under Namespace
Modules: ActsAsPushable, ClassMethods, Rails
Classes: Railtie
Constant Summary
collapse
- VERSION =
"0.0.1"
Instance Method Summary
collapse
Instance Method Details
#collection_channel ⇒ Object
22
23
24
|
# File 'lib/pushable.rb', line 22
def collection_channel
self.class.name.underscore.pluralize
end
|
#evaluate(channel) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/pushable.rb', line 30
def evaluate(channel)
case channel
when :collections
collection_channel
when :instances
instance_channel
when Symbol associate = send(channel)
"#{associate.class.name.underscore}_#{associate.id}_#{self.class.name.underscore.pluralize}"
when String
eval '"' + channel + '"'
when Proc
evaluate channel.call(self)
end
end
|
#instance_channel ⇒ Object
26
27
28
|
# File 'lib/pushable.rb', line 26
def instance_channel
"#{self.class.name.underscore}_#{id}"
end
|