hashdiff 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dbf060a0b7537d436fdf1a5000e37e16227bdbe
4
- data.tar.gz: 4c2b8998e3f78648c542cc4c8c7a3c95de4a6256
3
+ metadata.gz: f76f1e64a73818c32f00f87cac3ba70d68253b10
4
+ data.tar.gz: a21cb6f9b8657866cca3628f1489301546baf2f8
5
5
  SHA512:
6
- metadata.gz: 239b84f71304f154f89ab66c2b654bde48ccdaa3d1ed5748bb89f6449ea7ac8a34749a32f702e0684ea6e070940d4444c38705da413bdf017c6b3a1d6715a516
7
- data.tar.gz: d20d20328d875a9bd52f6087b3a1cf494534346303e1def382f0a3b836adcb047c99f421a5263d072ebad01830f2b3101962b01ef2eb3bcd9adbf313c3c799c0
6
+ metadata.gz: 9d5e16abeea6634037f6e3696530ea575a8373a19a431ecbe4ab792e9e47d907a380fee1eb65f9aa33e5b0fc48e1237a004fc1859d74583161909ee35d72ac4d
7
+ data.tar.gz: 92a95d686c55d47db575f768cbf9fc0c4e274b86b1c454f6780135a2db5bf6ac007fa54e5e3e3fad37628313791624634a1e309999e1810d21a37585a051cdfb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # HashDiff [![Build Status](https://secure.travis-ci.org/liufengyun/hashdiff.png)](http://travis-ci.org/liufengyun/hashdiff)
1
+ # HashDiff [![Build Status](https://secure.travis-ci.org/liufengyun/hashdiff.png)](http://travis-ci.org/liufengyun/hashdiff) [![Gem Version](https://badge.fury.io/rb/hashdiff.png)](http://badge.fury.io/rb/hashdiff)
2
2
 
3
3
  HashDiff is a ruby library to compute the smallest difference between two hashes.
4
4
 
@@ -81,7 +81,9 @@ unpatch example:
81
81
 
82
82
  ### Options
83
83
 
84
- You can specify the delimiter to be something else than the dot. For example:
84
+ There're two options available: `:delimiter` and `:similarity`.
85
+
86
+ You can specify `:delimiter` to be something else than the dot. For example:
85
87
 
86
88
  a = {a:{x:2, y:3, z:4}, b:{x:3, z:45}}
87
89
  b = {a:{y:3}, b:{y:3, z:30}}
@@ -89,7 +91,7 @@ You can specify the delimiter to be something else than the dot. For example:
89
91
  diff = HashDiff.diff(a, b, :delimiter => '\t')
90
92
  diff.should == [['-', 'a\tx', 2], ['-', 'a\tz', 4], ['-', 'b\tx', 3], ['~', 'b\tz', 45, 30], ['+', 'b\ty', 3]]
91
93
 
92
- In cases you have similar hash objects in array, you can pass suitable `:similarity` value instead of the default `0.8`.
94
+ In cases you have similar hash objects in array, you can pass a custom value for `:similarity` instead of the default `0.8`.
93
95
 
94
96
  ## Contributors
95
97
 
data/hashdiff.gemspec CHANGED
@@ -4,6 +4,7 @@ require 'hashdiff/version'
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{hashdiff}
6
6
  s.version = HashDiff::VERSION
7
+ s.license = 'MIT'
7
8
  s.summary = %q{ HashDiff is a diff lib to compute the smallest difference between two hashes. }
8
9
  s.description = %q{ HashDiff is a diff lib to compute the smallest difference between two hashes. }
9
10
 
data/lib/hashdiff/diff.rb CHANGED
@@ -6,8 +6,8 @@ module HashDiff
6
6
  #
7
7
  # @param [Arrary, Hash] obj1
8
8
  # @param [Arrary, Hash] obj2
9
- # @param [Hash] options
10
- # `options` supports `:delimiter`. Default value for `:delimiter` is `.`(dot).
9
+ # @param [Hash] options supports following keys:
10
+ # :delimiter - default value is '.'(dot).
11
11
  #
12
12
  # @return [Array] an array of changes.
13
13
  # e.g. [[ '+', 'a.b', '45' ], [ '-', 'a.c', '5' ], [ '~', 'a.x', '45', '63']]
@@ -40,12 +40,10 @@ module HashDiff
40
40
  #
41
41
  # @param [Arrary, Hash] obj1
42
42
  # @param [Arrary, Hash] obj2
43
- # @param [Hash] options
44
- # `options` can contain `:similarity` or `:delimiter`.
43
+ # @param [Hash] options supports following keys:
44
+ # :similarity - should be between (0, 1]. The default value is 0.8. :similarity is meaningful if there're similar hashes in arrays. See {best_diff}.
45
45
  #
46
- # `:similarity` should be between (0, 1]. The default value is `0.8`. `:similarity` is meaningful if there're similar hashes in arrays. See {best_diff}.
47
- #
48
- # `:delimiter` defaults to `.`(dot).
46
+ # :delimiter - defaults to '.'(dot).
49
47
  #
50
48
  # @return [Array] an array of changes.
51
49
  # e.g. [[ '+', 'a.b', '45' ], [ '-', 'a.c', '5' ], [ '~', 'a.x', '45', '63']]
@@ -7,8 +7,8 @@ module HashDiff
7
7
  #
8
8
  # @param [Hash, Array] obj the object to be patchted, can be an Array of a Hash
9
9
  # @param [Array] changes e.g. [[ '+', 'a.b', '45' ], [ '-', 'a.c', '5' ], [ '~', 'a.x', '45', '63']]
10
- # @param [Hash] options
11
- # `options` supports `:delimiter`. Default value for `:delimiter` is `.`(dot).
10
+ # @param [Hash] options supports following keys:
11
+ # :delimiter - default value is '.'(dot).
12
12
  #
13
13
  # @return the object after patch
14
14
  #
@@ -46,8 +46,8 @@ module HashDiff
46
46
  #
47
47
  # @param [Hash, Array] obj the object to be unpatchted, can be an Array of a Hash
48
48
  # @param [Array] changes e.g. [[ '+', 'a.b', '45' ], [ '-', 'a.c', '5' ], [ '~', 'a.x', '45', '63']]
49
- # @param [Hash] options
50
- # `options` supports `:delimiter`. Default value for `:delimiter` is `.`(dot).
49
+ # @param [Hash] options supports following keys:
50
+ # :delimiter - default value is '.'(dot).
51
51
  #
52
52
  # @return the object after unpatch
53
53
  #
@@ -1,3 +1,3 @@
1
1
  module HashDiff
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Fengyun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-25 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -84,7 +84,8 @@ files:
84
84
  - spec/hashdiff/util_spec.rb
85
85
  - spec/spec_helper.rb
86
86
  homepage: https://github.com/liufengyun/hashdiff
87
- licenses: []
87
+ licenses:
88
+ - MIT
88
89
  metadata: {}
89
90
  post_install_message:
90
91
  rdoc_options: []