yake 0.5.4 → 0.5.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: 1c140a121e6c40b6342e4b69a30eea098b2ab53008b2b2e7b315d1d0db794dc5
4
- data.tar.gz: a10c028d45ce96b4680f2caec4b031064c8f9737c09f4f82ac974ae8e077940d
3
+ metadata.gz: d97ba087d51b600bac660504eacdd1d590f9acf5904baa20be399027ecbf85f2
4
+ data.tar.gz: 56d692bba03ba85e82d79fdceca350cb975654b13a6ba46441ce950e9c86b213
5
5
  SHA512:
6
- metadata.gz: 47a790dbc53bbf1af9c6504f4bddba3a3759c237164f8ff466c876b6fe21c8c22d9e5f3d2d271ec489d25709223e9605f5b4bb4737463bc8dc67a5ea472f0ed9
7
- data.tar.gz: 50e642a1e4f7c5fa3d611c0d54811e91391d2a8df7e6796e723694a4db116db050d7e69cd91d041e37073d4efe6a77d34b1509fbb9a5a086d7543642ee1f836d
6
+ metadata.gz: e707b8cf74c1cee8bd58e8345760a2680687296d9a5eb487b8f6320cf4b44b8817f2d281179cd4c20838eeb3c32f394e1a2ab77293999617b5a4fc9621ffca4e
7
+ data.tar.gz: bf1339315504d1e47a7158a7a99175bd147372231c44e9344ec989122dd43e448ab5f2b8d9fcb20f65bef3b2c2fea88800d8677e02adcbb515b9e8b5a5322b68
data/README.md CHANGED
@@ -189,7 +189,17 @@ Enable the helpers by requiring the `support` submodule:
189
189
  require 'yake/support'
190
190
  ```
191
191
 
192
- `Hash` transformations:
192
+ `Object` helpers:
193
+
194
+ ```ruby
195
+ MyObject.new.some_method
196
+ # => NoMethodError
197
+
198
+ MyObject.new.try(:some_method)
199
+ # => nil
200
+ ```
201
+
202
+ `Hash` helpers:
193
203
 
194
204
  ```ruby
195
205
  { fizz: 'buzz' }.encode64
@@ -198,6 +208,9 @@ require 'yake/support'
198
208
  { fizz: 'buzz' }.strict_encode64
199
209
  # => "eyJmaXp6IjoiYnV6eiJ9"
200
210
 
211
+ { fizz: { buzz: %w[jazz fuzz] } }.stringify_names
212
+ # => { "fizz" => { "buzz" => ["jazz", "fuzz"] } }
213
+
201
214
  { 'fizz' => { 'buzz' => %w[jazz fuzz] } }.symbolize_names
202
215
  # => { :fizz => { :buzz => ["jazz", "fuzz"] } }
203
216
 
@@ -205,7 +218,7 @@ require 'yake/support'
205
218
  # => "fizz=buzz"
206
219
  ```
207
220
 
208
- `Integer` transformations:
221
+ `Integer` helpers:
209
222
 
210
223
  ```ruby
211
224
  7.weeks
@@ -224,7 +237,7 @@ require 'yake/support'
224
237
  # => 2009-02-13 23:31:30 UTC
225
238
  ```
226
239
 
227
- `String` transformations:
240
+ `String` helpers:
228
241
 
229
242
  ```ruby
230
243
  host = 'https://example.com/'
@@ -257,7 +270,7 @@ host / path
257
270
  # => { "fizz" => "buzz" }
258
271
  ```
259
272
 
260
- `Symbol` transformations
273
+ `Symbol` helpers
261
274
 
262
275
  ```ruby
263
276
  :snake_case_symbol.camel_case
@@ -267,7 +280,7 @@ host / path
267
280
  # => :camel_case_symbol
268
281
  ```
269
282
 
270
- `UTC` Time helper
283
+ `UTC` Time helpers
271
284
 
272
285
  ```ruby
273
286
  UTC.at 1234567890
data/lib/yake/support.rb CHANGED
@@ -26,6 +26,14 @@ class Integer
26
26
  alias :week :weeks
27
27
  end
28
28
 
29
+ class Object
30
+ def try(method, *args, **kwargs)
31
+ send(method, *args, **kwargs)
32
+ rescue
33
+ nil
34
+ end
35
+ end
36
+
29
37
  class String
30
38
  def /(path) File.join(self, path.to_s) end
31
39
  def camel_case() split(/_/).map(&:capitalize).join end
data/lib/yake/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yake
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Mancevice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-12 00:00:00.000000000 Z
11
+ date: 2022-04-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: