csv_json_converter 0.1.3 → 0.1.5

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: f4a861d0f37952316e996ed45a1838727f8639cbeac64b393b6f0f10b6444822
4
- data.tar.gz: 712b4ac2af69d0e11441338e1ab190e2d93f0169ba8d21937c1dce41d1618c85
3
+ metadata.gz: b18ca7a164f2cd0734d5c66d0f8783e797a7c9c3ff783cf91996b97cf1b5654d
4
+ data.tar.gz: 0d53ebb69cf99cb51949900f504400284e24776cb4b6a14c607ed9d95bce2f7e
5
5
  SHA512:
6
- metadata.gz: 668f30cfdfe949fdc2c4f6998428d9da52020ea5175682b7ef958c9f80c0f3cb61d1864b4a9a4d9df2d7b642e306b4bdb433632cad8815747d32545a0d76a748
7
- data.tar.gz: 9ea7c0e6f7203587a295201f2871e918b8f40395eba99a2958be53267ec5055dc271d97892adf17fcd97912d863c67fa1768e77f44665c2ae1eaec873173c1f3
6
+ metadata.gz: b5ecc2bc8950d09f0e923a7650050c0810ef2181600a951bd67e18106561e0b6b1ad5715e358c6c9c850bd022b175eeaffef9670eda3d263e6eb933f19352480
7
+ data.tar.gz: 8f8c1bdcb7b0551b11ac838f0d6aa46dcb58fc1b235ab23dcabe0027d76e2c2c8853abd6076d88c6b8eafb8eefb6738845a75a9c4e54c89506cf4922e7bbc55f
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # CsvJsonConverter
2
2
 
3
3
  <a name="readme-top"></a>
4
- # :green_book: Table of Contents
5
- [![csv_json_ - converter](https://img.shields.io/badge/json__or__ruby__to__-csv-2ea44f)](https://rubygems.org/gems/csv_json_converter)
4
+ [![csv_json_ - converter](https://img.shields.io/badge/csv_json_convert_-csv-2ea44f)](https://rubygems.org/gems/csv_json_converter)
6
5
  - [:green_book: Table of Contents](#-table-of-contents)
7
6
  - [:book: csv\_json\_converter ](#-csv_json_converter-)
8
7
  - [Installation ](#installation-)
9
8
  - [Usage](#usage)
10
- - [Using to\_json](#csv_to_json)
11
- - [Using activerecord\_to\_csv](#using-activerecord_to_csv)
12
- - [json\_or\_ruby\_to\_csv usage with rails controller](#json_or_ruby_to_csv-usage-with-rails-controller)
9
+ - [Convert csv to json](#csv-to-json)
10
+ - [Convert json to csv](#json-to-csv)
13
11
  - [:busts_in_silhouette: Authors ](#-authors-)
14
12
  - [:handshake: Contributing ](#-contributing-)
15
13
  - [:star:️ Show your support ](#️-show-your-support-)
@@ -27,7 +25,7 @@ gem install csv_json_converter
27
25
  ```
28
26
  ### Usage
29
27
  `require` this gem on the top of your ruby code.
30
- #### Covert csv_to_json
28
+ ### Csv to json
31
29
  If you want to convert `csv string`, to json you can use `to_json` method from `CsvJsonConverter`. Let's see how:-
32
30
 
33
31
  <i>For example </i>
@@ -52,7 +50,30 @@ If you want to convert `csv string`, to json you can use `to_json` method from `
52
50
  "hex": "jz40cbafbec8d6f92e93d22ea6ef5b"
53
51
  }
54
52
  ```
53
+ ### Json to csv
54
+ If you want to convert `json object`, to json you can use `to_csv` method from `CsvJsonConverter`. Let's see how:-
55
55
 
56
+ <i>For example </i>
57
+ ```ruby
58
+
59
+ require 'csv_json_converter'
60
+
61
+ data_json={ "file": "test18.csv",
62
+ "text": "CMkABfAGXvmSFV",
63
+ "number": 9892576,
64
+ "hex": "jz40cbafbec8d6f92e93d22ea6ef5b"
65
+ }
66
+
67
+ csv_data = CsvJsonCoverter.to_csv(data_json)
68
+
69
+ print csv_data
70
+
71
+ ```
72
+
73
+ **The output looks like below**
74
+ ```
75
+ "file,text,number,hex\ntest18.csv,CMkABfAGXvmSFV,9892576,jz40cbafbec8d6f92e93d22ea6ef5b"
76
+ ```
56
77
  ## :busts_in_silhouette: Authors <a name="authors"></a>
57
78
  :bust_in_silhouette: Pablo Zambrano
58
79
  - GitHub: [@alexoid1](https://github.com/melashu)
Binary file
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/csv_json_converter/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "csv_json_converter"
7
+ spec.version = CsvJsonConverter::VERSION
8
+ spec.authors = ["alexoid1"]
9
+ spec.email = ["alexzambra2610@gmail.com"]
10
+
11
+ spec.summary = "This is a gem to covert csv to json string and vice versa"
12
+ spec.description = "This gem transform a csv string in a json string."
13
+ spec.homepage = "https://rubygems.org/gems/csv_json_converter"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["documentation_uri"] = "https://github.com/Alexoid1/csv_json_converter"
20
+ spec.metadata["source_code_uri"] = "https://github.com/Alexoid1/csv_json_converter"
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
26
+ end
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+
35
+ # For more information and examples about making a new gem, check out our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CsvJsonConverter
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_json_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexoid1
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-25 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem transform a csv string in a json string.
14
14
  email:
@@ -24,14 +24,17 @@ files:
24
24
  - LICENSE.txt
25
25
  - README.md
26
26
  - Rakefile
27
+ - csv_json_converter-0.1.4.gem
28
+ - csv_json_converter.gemspec
27
29
  - lib/csv_json_converter.rb
28
30
  - lib/csv_json_converter/version.rb
29
31
  - sig/csv_json_converter.rbs
30
- homepage: https://github.com/Alexoid1/csv_json_converter
32
+ homepage: https://rubygems.org/gems/csv_json_converter
31
33
  licenses:
32
34
  - MIT
33
35
  metadata:
34
- homepage_uri: https://github.com/Alexoid1/csv_json_converter
36
+ homepage_uri: https://rubygems.org/gems/csv_json_converter
37
+ documentation_uri: https://github.com/Alexoid1/csv_json_converter
35
38
  source_code_uri: https://github.com/Alexoid1/csv_json_converter
36
39
  post_install_message:
37
40
  rdoc_options: []
@@ -51,5 +54,5 @@ requirements: []
51
54
  rubygems_version: 3.4.10
52
55
  signing_key:
53
56
  specification_version: 4
54
- summary: This is a gem to covert csv to json string
57
+ summary: This is a gem to covert csv to json string and vice versa
55
58
  test_files: []