pakyow-support 1.0.0.rc2 → 1.0.0.rc3

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: 314bf8bfaac94636f0fad32add340d09bd84746019f3a528672e246f39c90b90
4
- data.tar.gz: 2fdcba09b15bcad3fec56233855d37b9f9fb5823daebdf251f3aec7588fee041
3
+ metadata.gz: bca7371b208b214e0e6d11b34c18e1e2a3ed07ee928c3a6bf294735ead3c788c
4
+ data.tar.gz: 37f763da6ce98cc8834e3dbd54154b9cb235071fbedcab9e62b47cf8baa06783
5
5
  SHA512:
6
- metadata.gz: 6fa043983a8c32bdb80acbc164ed86b67b9d1a32163c857aecc1df5f0ffabba09ceabb225de595b4d08711d721c4a7032163d7fcc83dce6b6796bb089c8ab794
7
- data.tar.gz: 5fd00153d9db2f5fef050af357951710b5c5c288a54fd74c185d6d1ac0bd0623e04a5ec82419c2b674e3cea1f13155ef0430d0318bf6eaebc11767eadc4c9515
6
+ metadata.gz: 2295387652388a3f3e6c24c3c4edcd478270c9f6972015183c98761f5dbdcbc0afc51437a498c71cc508d072543dc90ec267c63ea45889108b14fba5a344d511
7
+ data.tar.gz: a1fd0a60b5e80ac1c0e55da3220453c1e676c0e874d854fdc174ddc744ec56937a06f0d8fca58f311f47463e14f6ddc2a1f0d9ccfc95b4502998e548c0d8c7f8
@@ -218,6 +218,7 @@ module Pakyow
218
218
  end
219
219
 
220
220
  module InstanceMethods
221
+ # @api private
221
222
  def __hook_pipeline
222
223
  self.class.__hook_pipeline
223
224
  end
@@ -110,6 +110,7 @@ module Pakyow
110
110
  indifferentize_update_method :merge!, :update, :replace, :clear, :keep_if, :delete_if, :compact!, :reject!, :select!
111
111
  indifferentize_argument_method :>, :>=, :<=>, :<, :<=, :==
112
112
 
113
+ # @api private
113
114
  def internal_hash
114
115
  __getobj__
115
116
  end
@@ -7,7 +7,6 @@ require "pakyow/support/makeable/object_name"
7
7
 
8
8
  module Pakyow
9
9
  module Support
10
- # @api private
11
10
  module Makeable
12
11
  def self.extended(base)
13
12
  # Mixin the `make` event for objects that are hookable.
@@ -9,7 +9,7 @@ module Pakyow
9
9
  # can halt the pipeline, causing the result to be immediately returned without calling other
10
10
  # actions. State passed through the pipeline should include {Pipelined::Object}.
11
11
  #
12
- # See {Pakyow::App} and {Pakyow::Controller} for examples of more complex pipelines.
12
+ # See {Pakyow::App} and {Pakyow::Routing::Controller} for examples of more complex pipelines.
13
13
  #
14
14
  # @example
15
15
  # class App
@@ -2,17 +2,15 @@
2
2
 
3
3
  require "fileutils"
4
4
 
5
- require "pakyow/support/logging"
6
-
7
5
  module Pakyow
8
6
  module Support
9
7
  # Persists state for an object.
10
8
  #
11
9
  class Serializer
12
- attr_reader :object, :name, :path
10
+ attr_reader :object, :name, :path, :logger
13
11
 
14
- def initialize(object, name:, path:)
15
- @object, @name, @path = object, name, path
12
+ def initialize(object, name:, path:, logger:)
13
+ @object, @name, @path, @logger = object, name, path, logger
16
14
  end
17
15
 
18
16
  def serialize
@@ -21,9 +19,7 @@ module Pakyow
21
19
  file.write(Marshal.dump(@object.serialize))
22
20
  end
23
21
  rescue => error
24
- Logging.yield_or_raise(error) do |logger|
25
- logger.error "[Serializer] failed to serialize `#{@name}': #{error}"
26
- end
22
+ @logger.error "[Serializer] failed to serialize `#{@name}': #{error}"
27
23
  end
28
24
 
29
25
  def deserialize
@@ -34,9 +30,7 @@ module Pakyow
34
30
  end
35
31
  rescue => error
36
32
  FileUtils.rm(serialized_state_path)
37
- Logging.yield_or_raise(error) do |logger|
38
- logger.error "[Serializer] failed to deserialize `#{@name}': #{error}"
39
- end
33
+ @logger.error "[Serializer] failed to deserialize `#{@name}': #{error}"
40
34
  end
41
35
 
42
36
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakyow-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-04 00:00:00.000000000 Z
11
+ date: 2019-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -111,7 +111,6 @@ files:
111
111
  - lib/pakyow/support/indifferentize.rb
112
112
  - lib/pakyow/support/inflector.rb
113
113
  - lib/pakyow/support/inspectable.rb
114
- - lib/pakyow/support/logging.rb
115
114
  - lib/pakyow/support/makeable.rb
116
115
  - lib/pakyow/support/makeable/object_maker.rb
117
116
  - lib/pakyow/support/makeable/object_name.rb
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "logger"
4
-
5
- module Pakyow
6
- module Support
7
- module Logging
8
- # Yields Pakyow.logger if defined, otherwise raises `error`.
9
- #
10
- def self.yield_or_raise(error)
11
- if defined?(Pakyow.logger)
12
- yield(Pakyow.logger)
13
- else
14
- raise error
15
- end
16
- end
17
-
18
- # Yields Pakyow.logger if defined, or a default logger.
19
- #
20
- def self.safe
21
- logger = if defined?(Pakyow.logger) && Pakyow.logger
22
- Pakyow.logger
23
- else
24
- ::Logger.new($stdout)
25
- end
26
-
27
- yield logger
28
- end
29
- end
30
- end
31
- end