elf_ham 0.1.0 → 0.2.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -3
  3. data/lib/elf_ham/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72ffdb4148875be506a707206c8e98663e7f62262534be35c5a051183b9a770b
4
- data.tar.gz: '0843d1fa5afdb32025c8e719bc5c840614575fd1dd3d0f33a90b112610c6de9d'
3
+ metadata.gz: 31c43f2fb19baa2d2eb0e9458ea9ccadfd6f211a4372db4543b4cd5ef3b8a5cf
4
+ data.tar.gz: cf656cb6fbf83e9b8edafaecc189692ad0dbb79cd7b9db332eff91738b073674
5
5
  SHA512:
6
- metadata.gz: 648bef55f51fb9795a0503488150372e48c7729bcd8a6d48fec414469d3a365d2698bcf91ced47859402de8da288ee1bb368ff39fb351ad53810e078da48de27
7
- data.tar.gz: ce4d86ec8642704885411f0c94ebdb7543db05a52e37827525bb0bdf26b70fdca74993035e1fdfb520e66ed8410beab2f21c6b523f64eb86960affa1195b972e
6
+ metadata.gz: 4f39189b74b044d6089b9698ec62c10dd0bef0fe8cb950044dae1d80a059b622584c572629e43cdafa5555d3ab2851dfbcb8612a87a08ced141831f235e6f0f0
7
+ data.tar.gz: 43f5332a7924698e03f2159ecb3f30599cae63d1618203b46afca79e753d5e965b4decbb6d2da84de6faa78bcee53a3bd2f24174285c1035529ba52ae6bd865f
data/README.md CHANGED
@@ -2,12 +2,66 @@
2
2
 
3
3
  ElfHam is an extremely simple utility gem that's useful for transform CSVs.
4
4
 
5
- ## Usage
5
+ ## tldr;
6
6
 
7
- ```sh
8
- gem install elf_ham
7
+ ```ruby
8
+ require "elf_ham"
9
+
10
+ # Load your CSV:
11
+ elf_ham = ElfHam.new(ARGF.read)
12
+
13
+ # Filter rows:
14
+ elf_ham.select { |row| row["header2"] != "b" }
15
+
16
+ # Transform rows:
17
+ elf_ham.transform do |row|
18
+ row["header3"] = "elfham"
19
+ end
20
+
21
+ # Print the result
22
+ puts elf_ham.output
9
23
  ```
10
24
 
25
+ ## Instructions
26
+
27
+ 1. Install the gem:
28
+
29
+ ```sh
30
+ gem install elf_ham
31
+ ```
32
+
33
+ 2. Create a transformation script:
34
+
35
+ ```sh
36
+ echo '#!/usr/bin/env ruby
37
+
38
+ require "elf_ham"
39
+
40
+ puts ElfHam.new(ARGF.read).select do |row|
41
+ row["header2"] != "b"
42
+ end.transform do |row|
43
+ row["header3"] = "elfham"
44
+ end.output' > transform.rb
45
+ ```
46
+
47
+ 3. Make the script executable:
48
+
49
+ ```sh
50
+ chmod u+x transform.rb
51
+ ```
52
+
53
+ 4. Edit the script to your liking.
54
+
55
+ 5. Run it:
56
+
57
+ ```sh
58
+ transform.rb path/to/your.csv > transformed.csv
59
+
60
+ # or
61
+
62
+ cat path/to/your.csv | transform.rb > transformed.csv
63
+ ```
64
+
11
65
  ## Development
12
66
 
13
67
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ElfHam
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elf_ham
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Norman