kelredd-useful 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/Rakefile +1 -1
- data/lib/useful/ruby_extensions/hash.rb +7 -1
- data/lib/useful/version.rb +1 -1
- metadata +13 -4
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ spec = Gem::Specification.new do |s|
|
|
19
19
|
s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
|
20
20
|
# s.executables = ['useful']
|
21
21
|
|
22
|
-
|
22
|
+
s.add_dependency('json')
|
23
23
|
end
|
24
24
|
|
25
25
|
Rake::GemPackageTask.new(spec) do |pkg|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json' unless defined?(JSON) && defined?(JSON::parse)
|
2
|
+
|
1
3
|
module Useful
|
2
4
|
module RubyExtensions
|
3
5
|
module Hash
|
@@ -19,6 +21,10 @@ module Useful
|
|
19
21
|
hash
|
20
22
|
end
|
21
23
|
|
24
|
+
def from_json(string)
|
25
|
+
JSON.parse(string)
|
26
|
+
end
|
27
|
+
|
22
28
|
end
|
23
29
|
|
24
30
|
# Return a new hash with only keys in *keys
|
@@ -38,7 +44,7 @@ module Useful
|
|
38
44
|
def except!(*keys)
|
39
45
|
self.class.except(self, keys)
|
40
46
|
end
|
41
|
-
|
47
|
+
|
42
48
|
# Determines if a value exists for the provided key(s). Allows searching in nested hashes
|
43
49
|
def check_value?(*keys)
|
44
50
|
val = self[keys.first] || self[keys.first.to_s]
|
data/lib/useful/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kelredd-useful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelredd
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: json
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
16
25
|
description:
|
17
26
|
email: ""
|
18
27
|
executables: []
|