scout-essentials 1.9.3 → 1.9.4
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.
- checksums.yaml +4 -4
- data/.vimproject +1 -0
- data/VERSION +1 -1
- data/lib/scout/indiferent_hash/json.rb +5 -0
- data/lib/scout/indiferent_hash.rb +2 -1
- data/lib/scout/misc/digest.rb +11 -6
- data/scout-essentials.gemspec +4 -2
- data/test/scout/indiferent_hash/test_json.rb +13 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c52a3c7170e7713fb4e18570e618ba714c831c9cb2f92be536642c9cdda68159
|
|
4
|
+
data.tar.gz: b0f9f76343f9afdd26b399065137d8f93a7acd40c31f7a77595d178a566325d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9520fb49e93fb307b9b08eb1f3cbd1a4a1a65f7bca42bf469e68f7f7096654afd1d8d072121a0612615e5bad15e347321c7a761cf056e889b4b77fc7052b09ef
|
|
7
|
+
data.tar.gz: f84184bfa3d5fb278712703e7e6c631bd6456274dbc75ecac92a35d851c20d97957d45a498b4700727f0ec285573f4a1313f093d71b3c30ab84755df3e264055
|
data/.vimproject
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.9.
|
|
1
|
+
1.9.4
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require_relative 'indiferent_hash/options'
|
|
2
2
|
require_relative 'indiferent_hash/case_insensitive'
|
|
3
3
|
require_relative 'indiferent_hash/serialize'
|
|
4
|
+
require_relative 'indiferent_hash/json'
|
|
4
5
|
|
|
5
6
|
module IndiferentHash
|
|
6
7
|
|
|
@@ -143,7 +144,7 @@ module IndiferentHash
|
|
|
143
144
|
new
|
|
144
145
|
end
|
|
145
146
|
|
|
146
|
-
def pretty_print
|
|
147
|
+
def pretty_print(obj=nil)
|
|
147
148
|
Misc.format_definition_list(self, sep: "\n")
|
|
148
149
|
end
|
|
149
150
|
|
data/lib/scout/misc/digest.rb
CHANGED
|
@@ -68,12 +68,17 @@ module Misc
|
|
|
68
68
|
def self.fast_file_md5(file, sample = 3_000_000)
|
|
69
69
|
size = File.size(file)
|
|
70
70
|
sample_txt = size.to_s << ":"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
begin
|
|
72
|
+
File.open(file) do |f|
|
|
73
|
+
sample_txt << f.read(sample)
|
|
74
|
+
f.seek(size/2)
|
|
75
|
+
sample_txt << f.read(sample)
|
|
76
|
+
f.seek(size - sample - 1)
|
|
77
|
+
sample_txt << f.read(sample)
|
|
78
|
+
end
|
|
79
|
+
rescue
|
|
80
|
+
Log.exception $!
|
|
81
|
+
sample_txt = "Error sampling file: #{$!.message}"
|
|
77
82
|
end
|
|
78
83
|
Digest::MD5.hexdigest(sample_txt)
|
|
79
84
|
end
|
data/scout-essentials.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: scout-essentials 1.9.
|
|
5
|
+
# stub: scout-essentials 1.9.4 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "scout-essentials".freeze
|
|
9
|
-
s.version = "1.9.
|
|
9
|
+
s.version = "1.9.4".freeze
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
|
@@ -61,6 +61,7 @@ Gem::Specification.new do |s|
|
|
|
61
61
|
"lib/scout/exceptions.rb",
|
|
62
62
|
"lib/scout/indiferent_hash.rb",
|
|
63
63
|
"lib/scout/indiferent_hash/case_insensitive.rb",
|
|
64
|
+
"lib/scout/indiferent_hash/json.rb",
|
|
64
65
|
"lib/scout/indiferent_hash/options.rb",
|
|
65
66
|
"lib/scout/indiferent_hash/serialize.rb",
|
|
66
67
|
"lib/scout/log.rb",
|
|
@@ -144,6 +145,7 @@ Gem::Specification.new do |s|
|
|
|
144
145
|
"test/scout/annotation/test_dup_clone.rb",
|
|
145
146
|
"test/scout/indiferent_hash/test_case_insensitive.rb",
|
|
146
147
|
"test/scout/indiferent_hash/test_case_insensitive_staleness.rb",
|
|
148
|
+
"test/scout/indiferent_hash/test_json.rb",
|
|
147
149
|
"test/scout/indiferent_hash/test_options.rb",
|
|
148
150
|
"test/scout/indiferent_hash/test_string2hash_false.rb",
|
|
149
151
|
"test/scout/log/test_color.rb",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
|
3
|
+
|
|
4
|
+
class TestIndiferentHash < Test::Unit::TestCase
|
|
5
|
+
def test_json
|
|
6
|
+
h = IndiferentHash.setup({})
|
|
7
|
+
h['a'] = 1
|
|
8
|
+
h[:a] = 1
|
|
9
|
+
|
|
10
|
+
assert_equal ['a'], JSON.parse(h.to_json).keys
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scout-essentials
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miguel Vazquez
|
|
@@ -185,6 +185,7 @@ files:
|
|
|
185
185
|
- lib/scout/exceptions.rb
|
|
186
186
|
- lib/scout/indiferent_hash.rb
|
|
187
187
|
- lib/scout/indiferent_hash/case_insensitive.rb
|
|
188
|
+
- lib/scout/indiferent_hash/json.rb
|
|
188
189
|
- lib/scout/indiferent_hash/options.rb
|
|
189
190
|
- lib/scout/indiferent_hash/serialize.rb
|
|
190
191
|
- lib/scout/log.rb
|
|
@@ -268,6 +269,7 @@ files:
|
|
|
268
269
|
- test/scout/annotation/test_dup_clone.rb
|
|
269
270
|
- test/scout/indiferent_hash/test_case_insensitive.rb
|
|
270
271
|
- test/scout/indiferent_hash/test_case_insensitive_staleness.rb
|
|
272
|
+
- test/scout/indiferent_hash/test_json.rb
|
|
271
273
|
- test/scout/indiferent_hash/test_options.rb
|
|
272
274
|
- test/scout/indiferent_hash/test_string2hash_false.rb
|
|
273
275
|
- test/scout/log/test_color.rb
|