ruby-redis 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/redis/config.rb CHANGED
@@ -1,38 +1,43 @@
1
- require File.expand_path '../redis', File.dirname(__FILE__)
2
-
3
- class Redis
4
-
1
+ module Redis
5
2
  class Config < Hash
6
3
 
7
4
  INTEGERS = [:port, :timeout, :databases]
8
5
  BOOLEANS = [:daemonize]
9
6
 
10
- def initialize argf
11
- super()
7
+ def initialize argf_or_hash
12
8
 
13
9
  # defaults
14
10
  self[:dir] = '.'
15
11
  self[:logfile] = 'stdout'
12
+ self[:loglevel] = 'verbose'
16
13
  self[:daemonize] = false
14
+ self[:pidfile] = '/var/run/redis.pid'
15
+ self[:bind] = '127.0.0.1'
17
16
  self[:port] = 6379
18
- self[:pidfile] = "/var/run/redis.pid"
17
+ self[:timeout] = 300
19
18
  self[:databases] = 16
20
19
 
21
- # load from ARGF or IO compatible interface
22
- argf.each do |line|
23
- key, val = line.split ' ', 2
24
- self[key.downcase.gsub(/-/,'_').to_sym] = val.chomp "\n"
20
+ this = super()
21
+ if Hash === argf_or_hash
22
+ super argf_or_hash
23
+ else
24
+ super()
25
+ # load from ARGF or IO compatible interface
26
+ argf_or_hash.each do |line|
27
+ key, val = line.split ' ', 2
28
+ self[key.downcase.gsub(/-/,'_').to_sym] = val.chomp "\n"
29
+ end
25
30
  end
26
31
 
27
32
  # convert
28
33
  INTEGERS.each do |key|
29
- self[key] = self[key].to_i
34
+ this[key] = this[key].to_i
30
35
  end
31
36
 
32
37
  # convert
33
38
  BOOLEANS.each do |key|
34
- next unless String===self[key]
35
- self[key] = case self[key].downcase
39
+ next unless String===this[key]
40
+ this[key] = case this[key].downcase
36
41
  when 'yes' then true
37
42
  when 'no' then false
38
43
  else nil
@@ -40,7 +45,5 @@ class Redis
40
45
  end
41
46
 
42
47
  end
43
-
44
48
  end
45
-
46
49
  end
data/lib/redis/config.rbc CHANGED
@@ -1,6 +1,6 @@
1
1
  !RBIX
2
- 6235178746665710376
3
- x
2
+ 8948944263761558646
3
+ 18
4
4
  M
5
5
  1
6
6
  n
@@ -9,57 +9,32 @@ x
9
9
  10
10
10
  __script__
11
11
  i
12
- 54
13
- 5
14
- 45
15
- 0
16
- 1
17
- 7
18
- 2
19
- 64
20
- 45
21
- 0
22
- 3
23
- 65
24
- 49
25
- 4
26
- 0
27
- 49
28
- 5
29
- 1
30
- 49
31
- 6
32
- 2
33
- 47
34
- 49
35
- 7
36
- 1
37
- 15
12
+ 29
38
13
  99
39
14
  7
40
- 8
15
+ 0
41
16
  1
42
17
  65
43
18
  49
44
- 9
19
+ 1
45
20
  3
46
21
  13
47
22
  99
48
23
  12
49
24
  7
50
- 10
25
+ 2
51
26
  12
52
27
  7
53
- 11
28
+ 3
54
29
  12
55
30
  65
56
31
  12
57
32
  49
58
- 12
33
+ 4
59
34
  4
60
35
  15
61
36
  49
62
- 10
37
+ 2
63
38
  0
64
39
  15
65
40
  2
@@ -72,29 +47,11 @@ I
72
47
  0
73
48
  I
74
49
  0
50
+ I
51
+ 0
75
52
  n
76
53
  p
77
- 13
78
- x
79
- 4
80
- File
81
- n
82
- s
83
- 8
84
- ../redis
85
- n
86
- x
87
- 11
88
- active_path
89
- x
90
- 7
91
- dirname
92
- x
93
- 11
94
- expand_path
95
- x
96
- 7
97
- require
54
+ 5
98
55
  x
99
56
  5
100
57
  Redis
@@ -152,6 +109,8 @@ I
152
109
  0
153
110
  I
154
111
  0
112
+ I
113
+ 0
155
114
  n
156
115
  p
157
116
  7
@@ -227,6 +186,8 @@ I
227
186
  0
228
187
  I
229
188
  0
189
+ I
190
+ 0
230
191
  n
231
192
  p
232
193
  11
@@ -262,87 +223,126 @@ x
262
223
  10
263
224
  initialize
264
225
  i
265
- 117
266
- 54
267
- 52
268
- 0
269
- 0
270
- 15
226
+ 185
271
227
  5
272
228
  7
273
- 1
229
+ 0
274
230
  7
275
- 2
231
+ 1
276
232
  64
277
233
  13
278
234
  18
279
235
  3
280
236
  47
281
237
  49
282
- 3
238
+ 2
283
239
  2
284
240
  15
285
241
  15
286
242
  5
287
243
  7
288
- 4
244
+ 3
289
245
  7
290
- 5
246
+ 4
291
247
  64
292
248
  13
293
249
  18
294
250
  3
295
251
  47
296
252
  49
297
- 3
253
+ 2
298
254
  2
299
255
  15
300
256
  15
301
257
  5
302
258
  7
259
+ 5
260
+ 7
303
261
  6
304
- 3
262
+ 64
305
263
  13
306
264
  18
307
265
  3
308
266
  47
309
267
  49
310
- 3
268
+ 2
311
269
  2
312
270
  15
313
271
  15
314
272
  5
315
273
  7
316
274
  7
317
- 7
318
- 8
275
+ 3
319
276
  13
320
277
  18
321
278
  3
322
279
  47
323
280
  49
324
- 3
281
+ 2
325
282
  2
326
283
  15
327
284
  15
328
285
  5
329
286
  7
287
+ 8
288
+ 7
330
289
  9
290
+ 64
291
+ 13
292
+ 18
293
+ 3
294
+ 47
295
+ 49
296
+ 2
297
+ 2
298
+ 15
299
+ 15
300
+ 5
331
301
  7
332
302
  10
303
+ 7
304
+ 11
333
305
  64
334
306
  13
335
307
  18
336
308
  3
337
309
  47
338
310
  49
311
+ 2
312
+ 2
313
+ 15
314
+ 15
315
+ 5
316
+ 7
317
+ 12
318
+ 7
319
+ 13
320
+ 13
321
+ 18
339
322
  3
323
+ 47
324
+ 49
325
+ 2
340
326
  2
341
327
  15
342
328
  15
343
329
  5
344
330
  7
345
- 11
331
+ 14
332
+ 7
333
+ 15
334
+ 13
335
+ 18
336
+ 3
337
+ 47
338
+ 49
339
+ 2
340
+ 2
341
+ 15
342
+ 15
343
+ 5
344
+ 7
345
+ 16
346
346
  4
347
347
  16
348
348
  13
@@ -350,50 +350,78 @@ i
350
350
  3
351
351
  47
352
352
  49
353
- 3
354
353
  2
354
+ 2
355
+ 15
355
356
  15
357
+ 54
358
+ 52
359
+ 17
360
+ 0
361
+ 19
362
+ 1
363
+ 15
364
+ 45
365
+ 18
366
+ 19
367
+ 20
368
+ 0
369
+ 86
370
+ 20
371
+ 9
372
+ 154
373
+ 20
374
+ 0
375
+ 54
376
+ 52
377
+ 17
378
+ 1
379
+ 8
380
+ 166
381
+ 54
382
+ 52
383
+ 17
384
+ 0
356
385
  15
357
386
  20
358
387
  0
359
388
  56
360
- 12
389
+ 21
361
390
  50
362
- 13
391
+ 22
363
392
  0
364
393
  15
365
394
  45
366
- 14
367
- 15
395
+ 23
396
+ 24
368
397
  56
369
- 16
398
+ 25
370
399
  50
371
- 13
400
+ 22
372
401
  0
373
402
  15
374
403
  45
375
- 17
376
- 18
404
+ 26
405
+ 27
377
406
  56
378
- 19
407
+ 28
379
408
  50
380
- 13
409
+ 22
381
410
  0
382
411
  11
383
412
  I
384
- 5
413
+ 6
385
414
  I
386
- 1
415
+ 2
387
416
  I
388
417
  1
389
418
  I
419
+ 0
420
+ I
390
421
  1
391
422
  n
392
423
  p
393
- 20
394
- x
395
- 10
396
- initialize
424
+ 29
397
425
  x
398
426
  3
399
427
  dir
@@ -410,22 +438,49 @@ s
410
438
  6
411
439
  stdout
412
440
  x
441
+ 8
442
+ loglevel
443
+ s
444
+ 7
445
+ verbose
446
+ x
413
447
  9
414
448
  daemonize
415
449
  x
450
+ 7
451
+ pidfile
452
+ s
453
+ 18
454
+ /var/run/redis.pid
455
+ x
456
+ 4
457
+ bind
458
+ s
459
+ 9
460
+ 127.0.0.1
461
+ x
416
462
  4
417
463
  port
418
464
  I
419
465
  18eb
420
466
  x
421
467
  7
422
- pidfile
423
- s
424
- 18
425
- /var/run/redis.pid
468
+ timeout
469
+ I
470
+ 12c
426
471
  x
427
472
  9
428
473
  databases
474
+ x
475
+ 10
476
+ initialize
477
+ x
478
+ 4
479
+ Hash
480
+ n
481
+ x
482
+ 3
483
+ ===
429
484
  M
430
485
  1
431
486
  p
@@ -522,6 +577,8 @@ I
522
577
  I
523
578
  1
524
579
  I
580
+ 0
581
+ I
525
582
  1
526
583
  n
527
584
  p
@@ -569,19 +626,19 @@ p
569
626
  I
570
627
  0
571
628
  I
572
- 16
629
+ 1a
573
630
  I
574
631
  4
575
632
  I
576
- 17
633
+ 1b
577
634
  I
578
635
  19
579
636
  I
580
- 2e
637
+ 31
581
638
  I
582
639
  1a
583
640
  I
584
- 18
641
+ 1c
585
642
  I
586
643
  4b
587
644
  x
@@ -618,18 +675,21 @@ x
618
675
  10
619
676
  initialize
620
677
  i
621
- 26
678
+ 28
622
679
  57
623
680
  19
624
681
  0
625
682
  15
626
- 5
683
+ 21
684
+ 1
685
+ 1
627
686
  20
628
687
  0
629
- 5
688
+ 21
689
+ 1
690
+ 1
630
691
  20
631
692
  0
632
- 47
633
693
  49
634
694
  0
635
695
  1
@@ -639,7 +699,6 @@ i
639
699
  13
640
700
  18
641
701
  3
642
- 47
643
702
  49
644
703
  2
645
704
  2
@@ -652,6 +711,8 @@ I
652
711
  I
653
712
  1
654
713
  I
714
+ 0
715
+ I
655
716
  1
656
717
  n
657
718
  p
@@ -666,21 +727,17 @@ x
666
727
  3
667
728
  []=
668
729
  p
669
- 7
730
+ 5
670
731
  I
671
732
  0
672
733
  I
673
- 1c
734
+ 21
674
735
  I
675
736
  4
676
737
  I
677
- 2e
678
- I
679
- 5
680
- I
681
- 1d
738
+ 22
682
739
  I
683
- 1a
740
+ 1c
684
741
  x
685
742
  52
686
743
  /Users/dturnbull/ruby/ruby-redis/lib/redis/config.rb
@@ -706,7 +763,7 @@ x
706
763
  10
707
764
  initialize
708
765
  i
709
- 76
766
+ 79
710
767
  57
711
768
  19
712
769
  0
@@ -714,30 +771,34 @@ i
714
771
  45
715
772
  0
716
773
  1
717
- 5
774
+ 21
775
+ 1
776
+ 1
718
777
  20
719
778
  0
720
- 47
721
779
  49
722
780
  2
723
781
  1
724
782
  86
725
783
  3
726
784
  9
727
- 21
785
+ 22
728
786
  1
729
787
  8
730
- 23
788
+ 24
731
789
  1
732
790
  11
733
791
  15
734
- 5
792
+ 21
793
+ 1
794
+ 1
735
795
  20
736
796
  0
737
- 5
797
+ 21
798
+ 1
799
+ 1
738
800
  20
739
801
  0
740
- 47
741
802
  49
742
803
  2
743
804
  1
@@ -753,11 +814,11 @@ i
753
814
  3
754
815
  1
755
816
  9
756
- 51
817
+ 55
757
818
  15
758
819
  2
759
820
  8
760
- 67
821
+ 71
761
822
  13
762
823
  7
763
824
  6
@@ -767,17 +828,16 @@ i
767
828
  3
768
829
  1
769
830
  9
770
- 65
831
+ 69
771
832
  15
772
833
  3
773
834
  8
774
- 67
835
+ 71
775
836
  15
776
837
  1
777
838
  13
778
839
  18
779
840
  3
780
- 47
781
841
  49
782
842
  7
783
843
  2
@@ -790,6 +850,8 @@ I
790
850
  I
791
851
  1
792
852
  I
853
+ 0
854
+ I
793
855
  1
794
856
  n
795
857
  p
@@ -817,45 +879,41 @@ x
817
879
  3
818
880
  []=
819
881
  p
820
- 19
882
+ 17
821
883
  I
822
884
  0
823
885
  I
824
- 21
886
+ 26
825
887
  I
826
888
  4
827
889
  I
828
- 22
829
- I
830
- 17
831
- I
832
- 0
890
+ 27
833
891
  I
834
892
  18
835
893
  I
836
- 2e
894
+ 0
837
895
  I
838
896
  19
839
897
  I
840
- 23
898
+ 28
841
899
  I
842
- 25
900
+ 29
843
901
  I
844
- 24
902
+ 29
845
903
  I
846
- 33
904
+ 37
847
905
  I
848
- 25
906
+ 2a
849
907
  I
850
- 42
908
+ 46
851
909
  I
852
- 26
910
+ 2b
853
911
  I
854
- 43
912
+ 47
855
913
  I
856
914
  0
857
915
  I
858
- 4c
916
+ 4f
859
917
  x
860
918
  52
861
919
  /Users/dturnbull/ruby/ruby-redis/lib/redis/config.rb
@@ -865,85 +923,128 @@ x
865
923
  3
866
924
  key
867
925
  p
868
- 35
926
+ 55
869
927
  I
870
928
  -1
871
929
  I
872
- a
930
+ 7
873
931
  I
874
932
  0
875
933
  I
934
+ 31
935
+ I
936
+ 1
937
+ I
938
+ a
939
+ I
940
+ f
941
+ I
942
+ 31
943
+ I
944
+ 10
945
+ I
876
946
  b
877
947
  I
878
- 5
948
+ 1e
949
+ I
950
+ 31
951
+ I
952
+ 1f
953
+ I
954
+ c
955
+ I
956
+ 2d
957
+ I
958
+ 31
879
959
  I
880
960
  2e
881
961
  I
882
- 6
962
+ d
963
+ I
964
+ 3a
965
+ I
966
+ 31
967
+ I
968
+ 3b
883
969
  I
884
970
  e
885
971
  I
886
- 14
972
+ 49
887
973
  I
888
- 2e
974
+ 31
889
975
  I
890
- 15
976
+ 4a
891
977
  I
892
978
  f
893
979
  I
894
- 23
980
+ 58
895
981
  I
896
- 2e
982
+ 31
897
983
  I
898
- 24
984
+ 59
899
985
  I
900
986
  10
901
987
  I
902
- 30
903
- I
904
- 2e
988
+ 66
905
989
  I
906
990
  31
907
991
  I
992
+ 67
993
+ I
908
994
  11
909
995
  I
910
- 3e
996
+ 74
911
997
  I
912
- 2e
998
+ 31
913
999
  I
914
- 3f
1000
+ 75
915
1001
  I
916
1002
  12
917
1003
  I
918
- 4d
1004
+ 82
919
1005
  I
920
- 2e
1006
+ 14
921
1007
  I
922
- 4e
1008
+ 89
923
1009
  I
924
- 13
1010
+ 15
925
1011
  I
926
- 5b
1012
+ 92
927
1013
  I
928
1014
  16
929
1015
  I
930
- 63
1016
+ 9a
931
1017
  I
932
- 1c
1018
+ 18
1019
+ I
1020
+ 9f
1021
+ I
1022
+ 1a
1023
+ I
1024
+ a6
1025
+ I
1026
+ 0
933
1027
  I
934
- 6c
1028
+ a7
935
1029
  I
936
1030
  21
937
1031
  I
938
- 75
1032
+ b0
1033
+ I
1034
+ 26
1035
+ I
1036
+ b9
939
1037
  x
940
1038
  52
941
1039
  /Users/dturnbull/ruby/ruby-redis/lib/redis/config.rb
942
1040
  p
943
- 1
1041
+ 2
1042
+ x
1043
+ 12
1044
+ argf_or_hash
944
1045
  x
945
1046
  4
946
- argf
1047
+ this
947
1048
  x
948
1049
  17
949
1050
  method_visibility
@@ -955,15 +1056,15 @@ p
955
1056
  I
956
1057
  2
957
1058
  I
958
- 7
1059
+ 4
959
1060
  I
960
1061
  11
961
1062
  I
962
- 8
1063
+ 5
963
1064
  I
964
1065
  1c
965
1066
  I
966
- a
1067
+ 7
967
1068
  I
968
1069
  2a
969
1070
  x
@@ -979,7 +1080,7 @@ p
979
1080
  I
980
1081
  2
981
1082
  I
982
- 5
1083
+ 2
983
1084
  I
984
1085
  1f
985
1086
  x
@@ -991,17 +1092,13 @@ x
991
1092
  13
992
1093
  attach_method
993
1094
  p
994
- 5
1095
+ 3
995
1096
  I
996
1097
  0
997
1098
  I
998
1099
  1
999
1100
  I
1000
- 19
1001
- I
1002
- 3
1003
- I
1004
- 36
1101
+ 1d
1005
1102
  x
1006
1103
  52
1007
1104
  /Users/dturnbull/ruby/ruby-redis/lib/redis/config.rb