• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pabloh / pathway / 23518166890

25 Mar 2026 12:02AM UTC coverage: 98.788% (-0.9%) from 99.681%
23518166890

Pull #58

github

web-flow
Merge d7a6e2d60 into ebf6b5e2d
Pull Request #58: Add callable steps

32 of 36 new or added lines in 2 files covered. (88.89%)

326 of 330 relevant lines covered (98.79%)

42.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.3
/lib/pathway/plugins/auto_deconstruct_state.rb
1
# frozen_string_literal: true
2

3
module Pathway
2✔
4
  module Plugins
2✔
5
    module AutoDeconstructState
2✔
6
      module ClassMethods
2✔
7
        attr_accessor :auto_deconstruct_state_on
2✔
8

9
        def inherited(subclass)
2✔
NEW
10
          super
×
NEW
11
          subclass.auto_deconstruct_state_on = auto_deconstruct_state_on
×
12
        end
13
      end
14

15
      module InstanceMethods
2✔
16
        extend Forwardable
2✔
17
        delegate :auto_deconstruct_state_on => 'self.class'
2✔
18
      end
19

20
      module DSLMethods
2✔
21
        private
2✔
22

23
        def _callable(callable, &block)
2✔
24
          next_step = super
12✔
25

26
          if callable.is_a?(Symbol) &&
12✔
27
            (block_given? && @operation.auto_deconstruct_state_on.member?(:block) && _can_deconstruct?(block) ||
10✔
28
            @operation.auto_deconstruct_state_on.member?(:method) && @operation.respond_to?(callable, true) &&
29
              _can_deconstruct?(@operation.method(callable)))
30

31
            ->(state, **kw) { next_step.call(**state, **kw) }
12✔
32
          else
33
            next_step
6✔
34
          end
35
        end
36

37
        def _can_deconstruct?(cb)= cb.parameters.all? { _1 in [:key|:keyreq|:keyrest|:block, *] }
22✔
38
      end
39

40
      OPTIONS = %i[all method block].freeze
2✔
41

42
      def self.apply(operation, on: :all)
2✔
43
        operation.auto_deconstruct_state_on= :all == on ? OPTIONS - [:all] : Array(on)
2✔
44
      end
45
    end
46
  end
47
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc