sdbcli 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/sdbcli +1 -1
  2. data/lib/sdbcli/sdb-runner.rb +18 -4
  3. metadata +3 -3
data/bin/sdbcli CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
3
3
 
4
- Version = '1.4.4'
4
+ Version = '1.4.5'
5
5
  HISTORY_FILE = File.join((ENV['HOME'] || ENV['USERPROFILE'] || '.'), '.sdbcli_history')
6
6
  HISTSIZE = 500
7
7
  SELECT_LIMIT = 2500
@@ -26,10 +26,12 @@ class Array
26
26
  def as_row
27
27
  row = self.dup
28
28
 
29
- def row.method_missing(method_name)
29
+ def row.method_missing(method_name, *args, &block)
30
30
  case method_name.to_s
31
31
  when /itemName/i
32
32
  self[0]
33
+ when /=\Z/
34
+ self[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
33
35
  else
34
36
  self[1][method_name.to_s]
35
37
  end
@@ -41,10 +43,12 @@ class Array
41
43
  def as_row!
42
44
  row = self
43
45
 
44
- def row.method_missing(method_name)
46
+ def row.method_missing(method_name, *args, &block)
45
47
  case method_name.to_s
46
48
  when /itemName/i
47
49
  self[0]
50
+ when /=\Z/
51
+ self[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
48
52
  else
49
53
  self[1][method_name.to_s]
50
54
  end
@@ -56,10 +60,15 @@ class Array
56
60
  def as_rows
57
61
  rows = self.dup
58
62
 
59
- def rows.method_missing(method_name)
63
+ def rows.method_missing(method_name, *args, &block)
60
64
  case method_name.to_s
61
65
  when /itemName/i
62
66
  self.map {|i| i[0] }
67
+ when /=\Z/
68
+ self.each do |i|
69
+ i[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
70
+ end
71
+ self
63
72
  else
64
73
  self.map {|i| i[1][method_name.to_s] }
65
74
  end
@@ -71,10 +80,15 @@ class Array
71
80
  def as_rows!
72
81
  rows = self
73
82
 
74
- def rows.method_missing(method_name)
83
+ def rows.method_missing(method_name, *args, &block)
75
84
  case method_name.to_s
76
85
  when /itemName/i
77
86
  self.map {|i| i[0] }
87
+ when /=\Z/
88
+ self.each do |i|
89
+ i[1][method_name.to_s.sub(/=\Z/, '')] = (args.length > 2) ? args : args[0]
90
+ end
91
+ self
78
92
  else
79
93
  self.map {|i| i[1][method_name.to_s] }
80
94
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdbcli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 4
10
- version: 1.4.4
9
+ - 5
10
+ version: 1.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel