marples 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -22,7 +22,7 @@ go to by enforcing a naming scheme.
22
22
  stomp_client = Stomp::Client.new ...
23
23
  m = Marples::Client.new stomp_client, "publisher"
24
24
  m.updated publication
25
- # => /topic/publisher.publications.updated
25
+ # => /topic/marples.publisher.publications.updated
26
26
  { 'guide' => { 'id' => 12345, 'title' => '...', ... }}
27
27
 
28
28
  ### Listening for messages
@@ -45,3 +45,33 @@ You can inject your logger into Marples to get some debugging information.
45
45
  producer = Marples::Client.new stomp_client, "publisher", logger
46
46
  ...
47
47
  consumer = Marples::Client.new stomp_client, 'consumer_name_here', logger
48
+
49
+
50
+ ## ActiveModel(ish) integration
51
+
52
+ If you'd like to get broadcasts of ActiveModel object (or objects whose
53
+ classes behave a little like ActiveModel in terms of callbacks) you can
54
+ include `Marples::ModelActionCallback` which will attempt to hook into
55
+ `after_create`, `after_save`, `after_update`, `after_destroy` and
56
+ `after_commit` to broadcast these actions. If your class doesn't have these
57
+ methods available the action will be skipped with no error.
58
+
59
+ Use it like this:
60
+
61
+ require 'marples/model_action_callback'
62
+ class Sandwich
63
+ include Marples::ModelActionCallback
64
+ end
65
+
66
+ Sandwich.marples_transport = Stomp::Client.new 'stomp://localhost:61613'
67
+ Sandwich.marples_client_name = 'menu'
68
+ Sandwich.marples_logger = Logger.new(STDOUT)
69
+
70
+ The interesting things that happen to sandwiches will now be broadcast for
71
+ other applications to pick up on as desired. No need to do anything special,
72
+ just use the model like you normally would:
73
+
74
+ s = Sandwich.new
75
+ s.add_filling "cheese"
76
+ s.add_filling "ham"
77
+ s.save!
@@ -1,3 +1,3 @@
1
1
  module Marples
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marples
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-31 00:00:00.000000000Z
13
+ date: 2011-11-10 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pethau
17
- requirement: &70310732945900 !ruby/object:Gem::Requirement
17
+ requirement: &70354359854080 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.0.2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70310732945900
25
+ version_requirements: *70354359854080
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: null_logger
28
- requirement: &70310732945480 !ruby/object:Gem::Requirement
28
+ requirement: &70354359853560 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70310732945480
36
+ version_requirements: *70354359853560
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activesupport
39
- requirement: &70310732945020 !ruby/object:Gem::Requirement
39
+ requirement: &70354359853020 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70310732945020
47
+ version_requirements: *70354359853020
48
48
  description: Message destination arbiter
49
49
  email:
50
50
  - craig@barkingiguana.com
@@ -58,8 +58,8 @@ files:
58
58
  - README.md
59
59
  - Rakefile
60
60
  - lib/marples.rb
61
- - lib/marples/active_record.rb
62
61
  - lib/marples/client.rb
62
+ - lib/marples/model_action_broadcast.rb
63
63
  - lib/marples/null_transport.rb
64
64
  - lib/marples/version.rb
65
65
  - marples.gemspec