Sha256: 71015fc84253aaa93ecf675ca28f02e70c425108c2239a3d90059a9a495dcaf8

Contents?: true

Size: 538 Bytes

Versions: 4

Compression:

Stored size: 538 Bytes

Contents

# frozen_string_literal: true

module Nina
  class Builder
    # Utility to get user defined callbacks
    class Callbacks < Initialization
      def copy
        Callbacks.new(@allow_list, to_h.dup)
      end

      def method_missing(method, *args, **kwargs, &block)
        return super unless @allow_list.include?(method)

        @atts[method] unless block
        @atts[method] ||= []
        @atts[method] << block
      end

      def respond_to_missing?(method, include_private = false)
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nina-0.1.6 lib/nina/builder/callbacks.rb
nina-0.1.5 lib/nina/builder/callbacks.rb
nina-0.1.4 lib/nina/builder/callbacks.rb
nina-0.1.2 lib/nina/builder/callbacks.rb