w-stdlib 0.0.12 → 0.0.13

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: 91974a1619f3422256a2242641122ae6d6772987f951a14f5ee9b0a14d181898
4
- data.tar.gz: 382a6972fd190d20e01ff8db0462b161ef23b92d983f5d373e30cc07e2f5061d
3
+ metadata.gz: 4c01012e9f0cd07f8a5e0b1ef8be0bc340a21cb796fb5e2aabffed48a29b108a
4
+ data.tar.gz: 5d838107d40c9a106f07161ca6ea9f2f115c9f458cb14e7ea5c85c1ebb5bbe06
5
5
  SHA512:
6
- metadata.gz: 3f49a7beee0df46384f7907e68c5aad231873d2cd521d4c27449d06040317b3e54b8f3a2569fac444b6e03c42016ad75a220ec4e47c0151dc91d664096f5cd7c
7
- data.tar.gz: 951c96aeefb755d40c872913fd0ba2946ae6c4a3294ea49275e75176e49f41a87e553857df91e70f8f957037f9a8e62f2687d76dc000339e764169005a986d7b
6
+ metadata.gz: a8f3e5b0f5a4c40b46483ec8393c71b666bdffde94beffac96035b7ed57756f442cb9c4c907dacc67feac2f9be7fe536b37a8c0d55e2c8930fb5315e8f5bb2a5
7
+ data.tar.gz: 3ad654bef43e5b301ff2777bbe5862c0cd049842eaa3ae16724e61f7ed8470002d7b74adffa9be99794fc21a41118034bfde42dfc25d3b0dad8cf4c8acf6dac7
@@ -9,6 +9,14 @@ module StringExt
9
9
  YAML.safe_load(self)
10
10
  end
11
11
 
12
+ def yaml_encode
13
+ to_yaml
14
+ end
15
+
16
+ def yaml_decode
17
+ from_yaml
18
+ end
19
+
12
20
  def from_json
13
21
  JSON.parse self
14
22
  end
@@ -25,6 +33,22 @@ module StringExt
25
33
  Base64.decode64 self
26
34
  end
27
35
 
36
+ def b64_encode
37
+ to_b64
38
+ end
39
+
40
+ def b64_decode
41
+ from_b64
42
+ end
43
+
44
+ def json_encode
45
+ to_json
46
+ end
47
+
48
+ def json_decode
49
+ from_json
50
+ end
51
+
28
52
  def url_encode
29
53
  CGI.escape self
30
54
  end
@@ -38,6 +38,14 @@ def read_lines(path)
38
38
  File.readlines(path).map(&:strip).reject(&:empty?)
39
39
  end
40
40
 
41
+ def stdin_lines
42
+ $stdin.lines.map(&:strip).reject(&:empty?)
43
+ end
44
+
45
+ def stdin_json
46
+ $stdin.read.from_json
47
+ end
48
+
41
49
  def write_lines(path, lines)
42
50
  File.write(path, lines.join("\n"))
43
51
  end
data/w-stdlib.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |g|
2
2
  g.name = 'w-stdlib'
3
- g.version = '0.0.12'
3
+ g.version = '0.0.13'
4
4
  g.summary = 'Pre-alpha package that contains abstractions that I find useful when scripting. Not suitable for production use. Breaking changes highly likely even with minor version bumps. Use at your own risk'
5
5
  g.description = g.summary
6
6
  g.authors = ['will@btlr.dev']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: w-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - will@btlr.dev