Skip to content

Commit

Permalink
Release 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Mar 9, 2022
1 parent b168512 commit 23fc497
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 22 deletions.
42 changes: 21 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
GIT
remote: https://github.com/msgpack/msgpack-ruby.git
revision: 04ccbd8e11c894cbf235b497b2dbd93338a647b8
revision: b69e6d6965ef46890885ddf73f02b820f3185d80
specs:
msgpack (1.4.5)

PATH
remote: .
specs:
paquito (0.3.1)
paquito (0.4.0)
msgpack

GEM
remote: https://rubygems.org/
specs:
activemodel (7.0.1)
activesupport (= 7.0.1)
activerecord (7.0.1)
activemodel (= 7.0.1)
activesupport (= 7.0.1)
activesupport (7.0.1)
activemodel (7.0.2.3)
activesupport (= 7.0.2.3)
activerecord (7.0.2.3)
activemodel (= 7.0.2.3)
activesupport (= 7.0.2.3)
activesupport (7.0.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -27,31 +27,31 @@ GEM
benchmark-ips (2.10.0)
byebug (11.1.3)
concurrent-ruby (1.1.9)
i18n (1.9.1)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
minitest (5.14.4)
minitest (5.15.0)
parallel (1.21.0)
parser (3.0.2.0)
parser (3.1.1.0)
ast (~> 2.4.1)
rainbow (3.0.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.1.1)
regexp_parser (2.2.1)
rexml (3.2.5)
rubocop (1.22.1)
rubocop (1.25.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.12.0, < 2.0)
rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.12.0)
parser (>= 3.0.1.1)
rubocop-shopify (2.3.0)
rubocop (~> 1.22)
rubocop-ast (1.16.0)
parser (>= 3.1.1.0)
rubocop-shopify (2.5.0)
rubocop (~> 1.25)
ruby-progressbar (1.11.0)
sorbet-runtime (0.5.9209)
sorbet-runtime (0.5.9742)
sqlite3 (1.4.2)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
Expand Down
2 changes: 2 additions & 0 deletions lib/paquito/allow_nil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ def initialize(coder)

def dump(object)
return nil if object.nil?

@coder.dump(object)
end

def load(payload)
return nil if payload.nil?

@coder.load(payload)
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/paquito/safe_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def initialize(...)

def dump_coder(target)
return unless permitted_class?(target.class)

super
end

Expand Down
1 change: 1 addition & 0 deletions lib/paquito/typed_struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def from_pack(packed)
if pack_digest != digest
raise(VersionMismatchError, "#{self} digests do not match")
end

new(**props.keys.zip(values).to_h)
end

Expand Down
4 changes: 4 additions & 0 deletions lib/paquito/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def unpacker(klass)
def register(klass, packer: nil, unpacker:)
if packer
raise ArgumentError, "packer for #{klass} already defined" if packers.key?(klass)

packers[klass] = packer
end

raise ArgumentError, "unpacker for #{klass} already defined" if unpackers.key?(klass)

unpackers[klass] = unpacker

self
Expand Down Expand Up @@ -155,6 +157,7 @@ def unpackers
unless value.instance_of?(ActiveSupport::HashWithIndifferentAccess)
raise PackError.new("cannot pack HashWithIndifferentClass subclass", value)
end

factory.dump(value.to_h)
end,
unpacker: ->(factory, value) { HashWithIndifferentAccess.new(factory.load(value)) },
Expand Down Expand Up @@ -263,6 +266,7 @@ def recursive_callback?(callback)
def curry_callback(callback, factory)
return callback.to_proc if callback.is_a?(Symbol)
return callback if callback.arity == 1

callback.curry.call(factory)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/paquito/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Paquito
VERSION = "0.3.1"
VERSION = "0.4.0"
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(name, &block)
test_name = "test_#{name.gsub(/\s+/, "_")}".to_sym
defined = method_defined?(test_name)
raise "#{test_name} is already defined in #{self}" if defined

if block_given?
define_method(test_name, &block)
else
Expand Down

0 comments on commit 23fc497

Please sign in to comment.