0.5.0
Added yake/support module for common transformations
Enable the helpers by requiring the support submodule:
require 'yake/support'Hash transformations:
{ fizz: 'buzz' }.encode64
# => "eyJmaXp6IjoiYnV6eiJ9\n"
{ fizz: 'buzz' }.strict_encode64
# => "eyJmaXp6IjoiYnV6eiJ9"
{ 'fizz' => { 'buzz' => %w[jazz fuzz] } }.symbolize_names
# => { :fizz => { :buzz => ["jazz", "fuzz"] } }
{ fizz: 'buzz' }.to_form
# => "fizz=buzz"Integer transformations:
7.days
# => 604800
7.hours
# => 25200
7.minutes
# => 420
1234567890.utc
# => 2009-02-13 23:31:30 UTCString transformations:
'snake_case_string'.camel_case
# => SnakeCaseString
"Zml6eg==\n".decode64
# => "fizz"
'fizz'.encode64
# => "Zml6eg==\n"
'CamelCaseString'.snake_case
# => 'camel_case_string'
'Zml6eg=='.strict_decode64
# => "fizz"
'fizz'.strict_encode64
# => "Zml6eg=="
'{"fizz":"buzz"}'.to_h_from_json
# => { "fizz" => "buzz" }
'fizz=buzz'.to_h_from_form
# => { "fizz" => "buzz" }Symbol transformations
:snake_case_symbol.camel_case
# => :SnakeCaseSymbol
:CamelCaseSymbol.snake_case
# => 'camel_case_symbol'UTC Time helper
UTC.at 1234567890
# => 2009-02-13 23:31:30 UTC
UTC.now
# => 2022-02-26 13:57:07.860539 UTC