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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa2a5b23a4e6627229255301bd5e8e9263e20333314e3334ed0359b6d387496b
4
- data.tar.gz: 1c2fd66f3b370a1325ab60d877cda1ba2d19f1c41930bc4e45c879cbf1aafec0
3
+ metadata.gz: c52a3c7170e7713fb4e18570e618ba714c831c9cb2f92be536642c9cdda68159
4
+ data.tar.gz: b0f9f76343f9afdd26b399065137d8f93a7acd40c31f7a77595d178a566325d3
5
5
  SHA512:
6
- metadata.gz: a6c8151e1d4323e586c85eeb28bf4a1ada40f829d7b7c2e35f52f442e7f03ceed5a0ca64d5c93ef38033849fc9d3d7ce95e325d76bfe953068dd51594a6f6a2c
7
- data.tar.gz: 3db4ca0f364ecfb5a4949a030f9ed35952e7d338e75663d46b185bf939f10821066efd80c8b80c852bd382da4fc8c4114293743977b5faabcf44d4f3dd3a16b3
6
+ metadata.gz: 9520fb49e93fb307b9b08eb1f3cbd1a4a1a65f7bca42bf469e68f7f7096654afd1d8d072121a0612615e5bad15e347321c7a761cf056e889b4b77fc7052b09ef
7
+ data.tar.gz: f84184bfa3d5fb278712703e7e6c631bd6456274dbc75ecac92a35d851c20d97957d45a498b4700727f0ec285573f4a1313f093d71b3c30ab84755df3e264055
data/.vimproject CHANGED
@@ -70,6 +70,7 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
70
70
  case_insensitive.rb
71
71
  options.rb
72
72
  serialize.rb
73
+ json.rb
73
74
  }
74
75
  log.rb
75
76
  log=log{
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.3
1
+ 1.9.4
@@ -0,0 +1,5 @@
1
+ module IndiferentHash
2
+ def to_json(...)
3
+ clean_version.to_json(...)
4
+ end
5
+ end
@@ -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
 
@@ -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
- File.open(file) do |f|
72
- sample_txt << f.read(sample)
73
- f.seek(size/2)
74
- sample_txt << f.read(sample)
75
- f.seek(size - sample - 1)
76
- sample_txt << f.read(sample)
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
@@ -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.3 ruby lib
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.3".freeze
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.3
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