w-stdlib 0.0.15 → 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
  SHA256:
3
- metadata.gz: de329ce379af0a89b8b8c7879ae89907b7e23922973ce14e83f94393b2725012
4
- data.tar.gz: d7860bd01015f1344cb96a05769954ebbdcc36e14243b90bc3ba80fa4044a036
3
+ metadata.gz: 2bbe8a05c2a3dab8eba6fca308e57529819f76c5da31e519ee604b9d8523bba9
4
+ data.tar.gz: f79d082a877a75cc90f4fb185b8ebfba489a83eee85d1c8b31541d0832b47a42
5
5
  SHA512:
6
- metadata.gz: fc7f4dc141c22b3a7e1ba26b31c11000756a83cbfee52da34df43c04dbf1c3aa7fb3058efb9102495f286ecb142833b1289e2e6aabe97969cac6cc177fe45d00
7
- data.tar.gz: 50058d76f55b2290a6cc25c65f1e7de23c2df24fdebb3c68fdc599d19c8119e81154ac4a9f83cb616fbce7688d432098a9ad6bf52c93cfa64677fafea83f29b4
6
+ metadata.gz: 40e37fa94b0b153c26b7ea22ef00410e07db758d25979ee56335f37e90ceb42ac619663f73af2f4c0eb93ec35d1f22746cad9caa930f771704209e85c6735649
7
+ data.tar.gz: a007d86fb5ef26eb110320dbc6aab0fcc391fc293f0181974c7fc2dbf642a0a705def2f1662e7a17cb438e7d7f6b3c22812bca9435c75b4767ccdfc3a5c45d9c
@@ -27,5 +27,9 @@ module HashExt
27
27
  def puts_all
28
28
  each { puts "#{_1}: #{_2}"}
29
29
  end
30
+
31
+ def pluck(*keys)
32
+ select { keys.include? _1 }
33
+ end
30
34
  end
31
35
  end
@@ -19,7 +19,6 @@ module StringExt
19
19
  alias_method :is_lowercase?, :is_downcase?
20
20
  alias_method :is_lower?, :is_downcase?
21
21
 
22
-
23
22
  def matches_glob?(pattern)
24
23
  File.fnmatch pattern, self
25
24
  end
@@ -33,6 +32,14 @@ module StringExt
33
32
  Base64.decode64 self
34
33
  end
35
34
 
35
+ def encode_hex
36
+ unpack('H*').first
37
+ end
38
+
39
+ def decode_hex
40
+ [self].pack('H*')
41
+ end
42
+
36
43
  def encode_url
37
44
  CGI.escape self
38
45
  end
@@ -1,8 +1,14 @@
1
1
  require 'http'
2
2
  require 'json'
3
3
  require_relative 'core_ext/string'
4
+ require_relative 'core_ext/array'
5
+ require_relative 'core_ext/hash'
6
+ require_relative 'core_ext/object'
4
7
 
5
8
  using StringExt
9
+ using ArrayExt
10
+ using HashExt
11
+ using ObjectExt
6
12
 
7
13
  def fatal(msg, code=1, pref='[!] ')
8
14
  STDERR.puts pref + msg
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.15'
3
+ g.version = '0.1.1'
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: w-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - will@btlr.dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-14 00:00:00.000000000 Z
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel