tofu 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tofu/version.rb +1 -1
  3. data/lib/tofu.rb +42 -42
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9121bc9617b25a0c2a9222157d3f5386b21e37a7
4
- data.tar.gz: 172050dc394215ba19559e6a0729b430166bfbfc
2
+ SHA256:
3
+ metadata.gz: 21f9b04d012b4d3bb5bfffd94cd49bb634d1f9e6b450437722572e840ded33bb
4
+ data.tar.gz: 7cb4a203cc8cb6aad6838b335c31d26433593e353de4cb4d754da3572f0c5182
5
5
  SHA512:
6
- metadata.gz: a21a4302fb45e23d5f2ee9d0218700977e142d44ac46f6f7b67ac67e8366215e405f0119d992a440e94cf040ea7319ecd7711a4e52f8fa91a64f0ca019a4356c
7
- data.tar.gz: 57f2fca271b937ae19303017ca55f9da134421f1cc91794bd11b4b54e42b8073fbf4ee7be3c7523e3e390ab626de695308f90aaefdf02c4e27f061bac9ea6d90
6
+ metadata.gz: 16e316ac4a6fe4d78394f308dc8391ecfddda3508117b8956258e34f42169541ebaff59e11fd2376f2262ebb9b4aec3f0d0c13f5848022d7346ceed5a8834b8d
7
+ data.tar.gz: b25dabe154550c5d145544a0049657d3968155363139e71681737a89b21d280ea2af1756576a6c7ba5f8f28e3d2c0515c3bd7fa7fae5ed2fc5f04f834617dad8
data/lib/tofu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tofu
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/tofu.rb CHANGED
@@ -25,9 +25,9 @@ module Tofu
25
25
  def service(context)
26
26
  case context.req_method
27
27
  when 'GET', 'POST', 'HEAD'
28
- do_GET(context)
28
+ do_GET(context)
29
29
  else
30
- context.res_method_not_allowed
30
+ context.res_method_not_allowed
31
31
  end
32
32
  end
33
33
 
@@ -69,7 +69,7 @@ module Tofu
69
69
 
70
70
  def entry(tofu)
71
71
  synchronize do
72
- @contents[tofu.tofu_id] = tofu
72
+ @contents[tofu.tofu_id] = tofu
73
73
  end
74
74
  end
75
75
 
@@ -155,7 +155,7 @@ module Tofu
155
155
  context.res_add_cookie(@prefix + '_id', sid, session.expires)
156
156
  hint = session.hint
157
157
  if hint
158
- context.res_add_cookie(@prefix +'_hint', hint, session.hint_expires)
158
+ context.res_add_cookie(@prefix +'_hint', hint, session.hint_expires)
159
159
  end
160
160
  session.renew
161
161
  return sid
@@ -191,11 +191,11 @@ module Tofu
191
191
 
192
192
  found = fname # default
193
193
  ary.each do |dir|
194
- path = File::join(dir, fname)
195
- if File::readable?(path)
196
- found = path
197
- break
198
- end
194
+ path = File::join(dir, fname)
195
+ if File::readable?(path)
196
+ found = path
197
+ break
198
+ end
199
199
  end
200
200
  found
201
201
  end
@@ -252,11 +252,11 @@ module Tofu
252
252
 
253
253
  def to_elem(element, context)
254
254
  elem(element, {'class'=>tofu_class, 'id'=>tofu_id}) {
255
- begin
256
- to_html(context)
257
- rescue
258
- "<p>error! #{h($!)}</p>"
259
- end
255
+ begin
256
+ to_html(context)
257
+ rescue
258
+ "<p>error! #{h($!)}</p>"
259
+ end
260
260
  }
261
261
  end
262
262
 
@@ -271,17 +271,17 @@ module Tofu
271
271
  msg = 'do_' + cmd.to_s
272
272
 
273
273
  if @tofu_seq
274
- seq, = params['tofu_seq']
275
- unless @tofu_seq.to_s == seq
276
- p [seq, @tofu_seq.to_s] if $DEBUG
277
- return
278
- end
274
+ seq, = params['tofu_seq']
275
+ unless @tofu_seq.to_s == seq
276
+ p [seq, @tofu_seq.to_s] if $DEBUG
277
+ return
278
+ end
279
279
  end
280
280
 
281
281
  if respond_to?(msg)
282
- send(msg, context, params)
282
+ send(msg, context, params)
283
283
  else
284
- do_else(context, params)
284
+ do_else(context, params)
285
285
  end
286
286
  ensure
287
287
  @tofu_seq = @tofu_seq.succ if @tofu_seq
@@ -297,11 +297,11 @@ module Tofu
297
297
  private
298
298
  def attr(opt)
299
299
  ary = opt.collect do |k, v|
300
- if v
301
- %Q!#{k}="#{h(v)}"!
302
- else
303
- nil
304
- end
300
+ if v
301
+ %Q!#{k}="#{h(v)}"!
302
+ else
303
+ nil
304
+ end
305
305
  end.compact
306
306
  return nil if ary.size == 0
307
307
  ary.join(' ')
@@ -312,14 +312,14 @@ module Tofu
312
312
  if block_given?
313
313
  %Q!<#{head}>\n#{yield}\n</#{name}>!
314
314
  else
315
- %Q!<#{head} />!
315
+ %Q!<#{head} />!
316
316
  end
317
317
  end
318
318
 
319
319
  def make_param(method_name, add_param={})
320
320
  param = {
321
- 'tofu_id' => tofu_id,
322
- 'tofu_cmd' => method_name
321
+ 'tofu_id' => tofu_id,
322
+ 'tofu_cmd' => method_name
323
323
  }
324
324
  param['tofu_seq'] = @tofu_seq if @tofu_seq
325
325
  param.update(add_param)
@@ -328,11 +328,11 @@ module Tofu
328
328
 
329
329
  def form(method_name, context_or_param, context_or_empty=nil)
330
330
  if context_or_empty.nil?
331
- context = context_or_param
332
- add_param = {}
331
+ context = context_or_param
332
+ add_param = {}
333
333
  else
334
- context = context_or_empty
335
- add_param = context_or_param
334
+ context = context_or_empty
335
+ add_param = context_or_param
336
336
  end
337
337
  param = make_param(method_name, add_param)
338
338
  hidden = input_hidden(param)
@@ -342,14 +342,14 @@ module Tofu
342
342
  def href(method_name, add_param, context)
343
343
  param = make_param(method_name, add_param)
344
344
  ary = param.collect do |k, v|
345
- "#{u(k)}=#{u(v)}"
345
+ "#{u(k)}=#{u(v)}"
346
346
  end
347
- %Q!href="#{action(context)}?#{ary.join(';')}"!
347
+ %Q!href="#{action(context)}?#{ary.join('&')}"!
348
348
  end
349
349
 
350
350
  def input_hidden(param)
351
351
  ary = param.collect do |k, v|
352
- %Q!<input type="hidden" name="#{h(k)}" value="#{h(v)}" />\n!
352
+ %Q!<input type="hidden" name="#{h(k)}" value="#{h(v)}" />\n!
353
353
  end
354
354
  ary.join('')
355
355
  end
@@ -366,7 +366,7 @@ module Tofu
366
366
  def reload_erb
367
367
  ObjectSpace.each_object(Class) do |o|
368
368
  if o.ancestors.include?(Tofu::Tofu)
369
- o.reload_erb
369
+ o.reload_erb
370
370
  end
371
371
  end
372
372
  end
@@ -393,7 +393,7 @@ module Tofu
393
393
  def req_params
394
394
  hash = {}
395
395
  @req.query.each do |k,v|
396
- hash[k] = v.list
396
+ hash[k] = v.list
397
397
  end
398
398
  hash
399
399
  end
@@ -437,8 +437,8 @@ module Tofu
437
437
 
438
438
  def res_header(k, v)
439
439
  if k.downcase == 'status'
440
- @res.status = v.to_i
441
- return
440
+ @res.status = v.to_i
441
+ return
442
442
  end
443
443
  @res[k] = v
444
444
  end
@@ -528,10 +528,10 @@ EOS
528
528
 
529
529
  param = make_param(method_name, param)
530
530
  ary = param.collect do |k, v|
531
- "#{u(k)}=#{u(v)}"
531
+ "#{u(k)}=#{u(v)}"
532
532
  end
533
533
  path = URI.parse(context.req_absolute_path)
534
- url = path + %Q!#{action(context)}?#{ary.join(';')}!
534
+ url = path + %Q!#{action(context)}?#{ary.join('&')}!
535
535
  %Q!tofu_x_update("#{target.tofu_id}", #{url.to_s.dump});!
536
536
  end
537
537
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tofu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masatoshi SEKI
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.5.1
90
+ rubygems_version: 2.7.7
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: tiny web-ui framework for me.