flexi-json 0.4.0 → 0.4.1

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: 4e8c41b6f187468d64f2d6d3321f7557a5ec17410a69508b8cc1391560ab81be
4
- data.tar.gz: 5b7aeb733149ae14bce5481878566a99b4a971232900285153278f11d74decf8
3
+ metadata.gz: 6d23543bb36512b335987eb6c12815956d98b170f2148fbbf12b92454064a96c
4
+ data.tar.gz: 8872ba4b925901cdeee8dcf27e5a409ca3784366dcf64ad370e60cdfe919bc54
5
5
  SHA512:
6
- metadata.gz: 717ae733016f7913d3ef4d2d8d065fbded43304ff3f62b45ede49abf1aed3de63144202fd17bd8e12e4fa0bde1b9c22067027a6f66f873201ce5f30434f9843d
7
- data.tar.gz: f08b3a2418807a5afce6e2b2c30db6e142829ff2c6fbe11968376f0612e8d6cc5a92315a8e98b377fb49c983d3229ca40ec0d3102982d488f0c4ff8e857d84ca
6
+ metadata.gz: 7acf01abdf37decc0f5d5d8a230da8b91f542d0dbb6c81efb90d5f229a1245b58764c0ba05fe0aa59b72348e3ef26b3b5484fc12f8700b108a49f3a0a4481c74
7
+ data.tar.gz: b6d8d236da0e37f0a9fd8a3785403363f5fc783820ea1ba351d7cf2647ec4f5666b24928ccd68a2eac6e0be94d4a41e707deb9acc948402acb8f91d4050a28dd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # Version: 0.4.1 (22-09-2024)
2
+
3
+ * [0270c44](https://github.com/GD-Personal/flexi-json/commit/0270c44d7ffabd88ed0b69b09f1e98910257d99b): Update the readme and changelog
4
+
5
+
6
+ # Version: 0.4.0 - 2024-09-22
7
+
8
+ * [#15](https://github.com/GD-Personal/flexi-json/pull/15): Add a configuration and renamed matched_all to match_all.
9
+
1
10
  # Version: 0.3.0 - 2024-09-22
2
11
 
3
12
  * [#10](https://github.com/GD-Personal/flexi-json/pull/10): Release 0.2.0
data/README.md CHANGED
@@ -28,18 +28,19 @@ bundle install
28
28
  ```ruby
29
29
  require 'flexi/json'
30
30
 
31
- # Load a json data from a local file
32
- flexi_json = Flexi::Json::Run.new("some/path/to/file.json")
33
-
34
31
  # Load a raw json data
35
- flexi_json = Flexi::Json::Run.new("{\"name\":\"John\",\"address\":\"Sydney Australia\"}")
36
- # => <Flexi::Json::Run:0x0000ffffa0f5fc58 @datasets=[#<Flexi::Json::Dataset:0x0000ffffa0f5f668 @address="Sydney Australia", @attributes={:name=>"John", :address=>"Sydney Australia"}, @name="John", @searchable_fields=["name", "address"]>]>
32
+ flexi_json = Flexi::Json.new("{\"name\":\"John\",\"address\":\"Sydney Australia\"}")
33
+ # => <Flexi::Json:0x0000ffffa0f5fc58 @datasets=[#<Flexi::Json::Dataset:0x0000ffffa0f5f668 @address="Sydney Australia", @attributes={:name=>"John", :address=>"Sydney Australia"}, @name="John", @searchable_fields=["name", "address"]>]>
37
34
 
38
- # Load a json data from aurl
39
- flexi_json = Flexi::Json::Run.new("https://raw.githubusercontent.com/GD-Personal/flexi-json/main/spec/data/dataset.json")
35
+ # Load a json data from a local file
36
+ flexi_json = Flexi::Json.new("some/path/to/file.json")
37
+
38
+ # Load a json data from a url
39
+ flexi_json = Flexi::Json.new("https://raw.githubusercontent.com/GD-Personal/flexi-json/main/spec/data/dataset.json")
40
40
 
41
41
  # Search for data
42
42
  flexi_json.search("john")
43
+ # => [#<Flexi::Json::Dataset:0x0000ffffa0f5f668 @address="Sydney Australia", @attributes={:name=>"John", :address=>"Sydney Australia"}, @name="John", @searchable_fields=["name", "address"]>]
43
44
 
44
45
  # Or filter it by your chosen key e.g first_name
45
46
  flexi_json.search("john", "first_name")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Flexi
4
4
  module Json
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
data/lib/flexi/json.rb CHANGED
@@ -19,21 +19,18 @@ module Flexi::Json
19
19
  def configure
20
20
  yield(configuration)
21
21
  end
22
- end
23
22
 
24
- class Run
25
- # Your code goes here...
26
- def initialize(data)
23
+ def new(data)
27
24
  datasets = Flexi::Json::Loader.new(data).load_data
28
25
  @searcher = Flexi::Json::Searcher.new(datasets)
29
26
  end
27
+ end
30
28
 
31
- def search(query = "", fields = nil)
32
- @searcher.search(query, fields)
33
- end
29
+ def search(query = "", fields = nil)
30
+ @searcher.search(query, fields)
31
+ end
34
32
 
35
- def find_duplicates(keys)
36
- @searcher.find_duplicates(keys)
37
- end
33
+ def find_duplicates(keys)
34
+ @searcher.find_duplicates(keys)
38
35
  end
39
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexi-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerda Decio