eventbus 0.30.2 → 0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/eventbus/message.rb +21 -2
  2. metadata +6 -6
@@ -9,6 +9,8 @@ module EventBus
9
9
  class Message
10
10
 
11
11
  attr_reader :data
12
+ attr_accessor :default_section
13
+ attr_accessor :global_section
12
14
 
13
15
  def initialize(application_id = EventBus.application_id)
14
16
 
@@ -28,6 +30,8 @@ class Message
28
30
  },
29
31
  'PAYLOAD' => {}
30
32
  }
33
+
34
+ self.global_section = "GLOBAL"
31
35
 
32
36
  @connection_driver = ENV["EVENTBUS_CONNECTOR"] || "Stomp"
33
37
 
@@ -41,12 +45,14 @@ class Message
41
45
  extend conn_module
42
46
 
43
47
  connection_driver_initialize
48
+
49
+
44
50
 
45
51
  end
46
52
 
47
53
 
48
54
  def set(key, val, opts = {})
49
-
55
+
50
56
  # This is for convenience and to make messages more
51
57
  # human-readable by eliminating the !Binary encoding
52
58
  # in YAML messages. I'm not willing to make this method
@@ -70,8 +76,11 @@ class Message
70
76
  end
71
77
 
72
78
  def get(key, opts = {})
79
+
73
80
  raise "You must specify a key name!" if key.nil?
74
81
  section = opts.delete(:section) || self.default_section_name
82
+
83
+ puts "Getting section #{section}"
75
84
 
76
85
  return @data['PAYLOAD'][section.to_s].nil? ? nil : @data['PAYLOAD'][section.to_s][key.to_s]
77
86
  end
@@ -177,7 +186,15 @@ class Message
177
186
  end
178
187
 
179
188
  def default_section_name
180
- return self.class.name.split(/::/).last
189
+ return self.default_section || self.class.name.split(/::/).last
190
+ end
191
+
192
+ def get_global(key)
193
+ return get(key, :section => @global_section)
194
+ end
195
+
196
+ def set_global(key, val)
197
+ return set(key, val, :section => @global_section)
181
198
  end
182
199
 
183
200
  private
@@ -194,6 +211,8 @@ class Message
194
211
  return @data[block.to_s][key.to_s]
195
212
  end
196
213
 
214
+
215
+
197
216
  end
198
217
 
199
218
  end # module EventBus
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.2
4
+ version: '0.31'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-06 00:00:00.000000000 Z
12
+ date: 2014-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amqp
@@ -81,13 +81,13 @@ executables: []
81
81
  extensions: []
82
82
  extra_rdoc_files: []
83
83
  files:
84
- - lib/eventbus/common_init.rb
84
+ - lib/eventbus/service.rb
85
+ - lib/eventbus/connectors/stomp.rb
85
86
  - lib/eventbus/connectors/amqp.rb
86
87
  - lib/eventbus/connectors/stomp/slogger.rb
87
- - lib/eventbus/connectors/stomp.rb
88
- - lib/eventbus/message.rb
89
88
  - lib/eventbus/queue.rb
90
- - lib/eventbus/service.rb
89
+ - lib/eventbus/message.rb
90
+ - lib/eventbus/common_init.rb
91
91
  homepage: http://spadea.net/?page_id=8
92
92
  licenses: []
93
93
  post_install_message: