Module: Syncromesh
- Extended by:
- Configuration
- Defined in:
- lib/syncromesh.rb,
lib/syncromesh/version.rb,
lib/syncromesh/configuration.rb
Defined Under Namespace
Modules: Configuration, SimplePoller
Constant Summary
collapse
- VERSION =
"0.3.0"
Class Method Summary
collapse
configuration, define_setting
Class Method Details
.after_change(model) ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/syncromesh.rb', line 78
def self.after_change(model)
if transport == :pusher
pusher.trigger(Syncromesh.channel, 'change', klass: model.class.name, record: model.react_serializer)
elsif transport == :simple_poller
SimplePoller.write('change', {klass: model.class.name, record: model.react_serializer})
elsif transport != :none
raise "Unknown transport #{Syncromesh.transport} - not supported"
end
end
|
.after_destroy(model) ⇒ Object
88
89
90
91
92
93
94
95
96
|
# File 'lib/syncromesh.rb', line 88
def self.after_destroy(model)
if transport == :pusher
pusher.trigger(Syncromesh.channel, 'destroy', klass: model.class.name, record: model.react_serializer)
elsif transport == :simple_poller
SimplePoller.write('destroy', {klass: model.class.name, record: model.react_serializer})
elsif transport != :none
raise "Unknown transport #{Syncromesh.transport} - not supported"
end
end
|
.channel ⇒ Object
74
75
76
|
# File 'lib/syncromesh.rb', line 74
def self.channel
"#{channel_prefix}"
end
|
.pusher ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/syncromesh.rb', line 61
def self.pusher
unless channel_prefix
transport = nil
raise "******** NO CHANNEL PREFIX SET ***************"
end
@pusher ||= Pusher::Client.new(
app_id: app_id,
key: key,
secret: secret,
encrypted: encrypted
)
end
|