kernel_hash 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +4 -0
  2. data/lib/kernel_hash.rb +15 -0
  3. metadata +63 -0
data/README ADDED
@@ -0,0 +1,4 @@
1
+ See http://redmine.ruby-lang.org/issues/show/3131
2
+
3
+ I hereby release this work into the Public Domain.
4
+ -- Suraj N. Kurapati, 22 April 2010.
@@ -0,0 +1,15 @@
1
+ # See http://redmine.ruby-lang.org/issues/show/3131
2
+
3
+ module Kernel
4
+ unless method_defined? :Hash
5
+ def Hash(value)
6
+ if value.respond_to? :to_hash
7
+ value.to_hash
8
+ elsif value.nil? or Array(value).empty?
9
+ {}
10
+ else
11
+ raise ArgumentError, "invalid value for Hash: #{value}"
12
+ end
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kernel_hash
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ version: 0.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Suraj N. Kurapati
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-22 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email:
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - README
31
+ - lib/kernel_hash.rb
32
+ has_rdoc: true
33
+ homepage: http://redmine.ruby-lang.org/issues/show/3131
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.3.6
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: Adds a Kernel#Hash() method like Kernel#Array()
62
+ test_files: []
63
+