norikra 0.0.14-java → 0.0.15-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -133,26 +133,27 @@ module Norikra
133
133
 
134
134
  def send(target_name, events)
135
135
  trace "send messages", :target => target_name, :events => events
136
- unless @targets.include?(target_name) # discard events for target not registered
136
+ unless @targets.any?{|t| t.name == target_name} # discard events for target not registered
137
137
  trace "messages skipped for non-opened target", :target => target_name
138
138
  return
139
139
  end
140
140
  return if events.size < 1
141
141
 
142
- if @typedef_manager.lazy?(target_name)
143
- info "opening lazy target", :target => target_name
144
- debug "generating base fieldset from event", :target => target_name, :event => events.first
145
- base_fieldset = @typedef_manager.generate_base_fieldset(target_name, events.first)
142
+ target = @targets.select{|t| t.name == target_name}.first
143
+
144
+ if @typedef_manager.lazy?(target.name)
145
+ info "opening lazy target", :target => target
146
+ debug "generating base fieldset from event", :target => target.name, :event => events.first
147
+ base_fieldset = @typedef_manager.generate_base_fieldset(target.name, events.first)
146
148
 
147
- debug "registering base fieldset", :target => target_name, :base => base_fieldset
148
- register_base_fieldset(target_name, base_fieldset)
149
+ debug "registering base fieldset", :target => target.name, :base => base_fieldset
150
+ register_base_fieldset(target.name, base_fieldset)
149
151
 
150
- info "target successfully opened with fieldset", :target => target_name, :base => base_fieldset
152
+ info "target successfully opened with fieldset", :target => target, :base => base_fieldset
151
153
  end
152
154
 
153
155
  registered_data_fieldset = @registered_fieldsets[target_name][:data]
154
156
 
155
- target = @targets.select{|t| t.name == target_name}.first
156
157
  strict_refer = (not target.auto_field?)
157
158
 
158
159
  events.each do |event|
@@ -12,10 +12,6 @@ module Norikra
12
12
  @auto_field = !!auto_field
13
13
  end
14
14
 
15
- def to_s
16
- @name
17
- end
18
-
19
15
  def to_hash
20
16
  {:name => @name, :auto_field => @auto_field}
21
17
  end
@@ -246,7 +246,7 @@ module Norikra
246
246
  def dump_all
247
247
  fields = {}
248
248
  @fields.each do |key,field|
249
- fields[field.name] = field.to_hash(true)
249
+ fields[field.name.to_sym] = field.to_hash(true)
250
250
  end
251
251
  fields
252
252
  end
@@ -1,3 +1,3 @@
1
1
  module Norikra
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -224,24 +224,23 @@ describe Norikra::TypedefManager do
224
224
  end
225
225
  end
226
226
 
227
- describe '#dump' do
228
- it 'returns array of target typedef dump' do
227
+ describe '#dump_target' do
228
+ it 'returns target typedef dump' do
229
229
  m = Norikra::TypedefManager.new
230
230
  m.add_target('sample', {'a'=>'string','b'=>'string','c'=>'double'})
231
231
  m.reserve('sample', 'z', 'boolean')
232
232
  m.add_target('sample_next', {'a'=>'string','b'=>'string','c'=>'double','d'=>'double'})
233
233
 
234
- r = m.dump
235
- expect(r.size).to eql(2)
236
- expect(r[0][:name]).to eql('sample')
237
- expect(r[0][:fields]).to eql({
234
+ r = m.dump_target('sample')
235
+ expect(r).to eql({
238
236
  a: {name: 'a', type: 'string', optional: false},
239
237
  b: {name: 'b', type: 'string', optional: false},
240
238
  c: {name: 'c', type: 'double', optional: false},
241
239
  z: {name: 'z', type: 'boolean', optional: true},
242
240
  })
243
- expect(r[1][:name]).to eql('sample_next')
244
- expect(r[1][:fields]).to eql({
241
+
242
+ r = m.dump_target('sample_next')
243
+ expect(r).to eql({
245
244
  a: {name: 'a', type: 'string', optional: false},
246
245
  b: {name: 'b', type: 'string', optional: false},
247
246
  c: {name: 'c', type: 'double', optional: false},
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: norikra
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.14
5
+ version: 0.0.15
6
6
  platform: java
7
7
  authors:
8
8
  - TAGOMORI Satoshi
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-16 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mizuno