ddbcli 0.1.0

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.
@@ -0,0 +1,43 @@
1
+ class Array
2
+ def sum
3
+ self.inject {|r, i| r + i }
4
+ end
5
+
6
+ def avg
7
+ self.sum / self.length
8
+ end
9
+
10
+ def group_by(name, &block)
11
+ item_h = {}
12
+
13
+ self.each do |item|
14
+ key = item[name.to_s]
15
+ item_h[key] ||= []
16
+ item_h[key] << item
17
+ end
18
+
19
+ return item_h unless block
20
+
21
+ new_item_h = {}
22
+
23
+ item_h.each do |key, item_list|
24
+ if block.arity == 2
25
+ new_item_h[key] = block.call(item_listm key)
26
+ else
27
+ new_item_h[key] = block.call(item_list)
28
+ end
29
+ end
30
+
31
+ return new_item_h
32
+ end
33
+
34
+ def method_missing(method_name, *args, &block)
35
+ case method_name.to_s
36
+ when /=\Z/
37
+ self.each {|i| i[method_name.to_s.sub(/=\Z/, '')] = *args }
38
+ self
39
+ else
40
+ self.map {|i| i[method_name.to_s] }
41
+ end
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ddbcli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - winebarrel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description:
31
+ email: sgwr_dts@yahoo.co.jp
32
+ executables:
33
+ - ddbcli
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - README
38
+ - bin/ddbcli
39
+ - lib/ddbcli/cli/evaluate.rb
40
+ - lib/ddbcli/cli/functions.rb
41
+ - lib/ddbcli/cli/help.rb
42
+ - lib/ddbcli/cli/options.rb
43
+ - lib/ddbcli/ddb-binary.rb
44
+ - lib/ddbcli/ddb-client.rb
45
+ - lib/ddbcli/ddb-driver.rb
46
+ - lib/ddbcli/ddb-endpoint.rb
47
+ - lib/ddbcli/ddb-error.rb
48
+ - lib/ddbcli/ddb-iteratorable.rb
49
+ - lib/ddbcli/ddb-parser.tab.rb
50
+ - lib/ddbcli/ddb-parser.y
51
+ - lib/ddbcli/ddb-rubyext.rb
52
+ - lib/ddbcli.rb
53
+ homepage: https://bitbucket.org/winebarrel/ddbcli
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 1.8.23
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: ddbcli is an interactive command-line client of Amazon DynamoDB.
77
+ test_files: []