Sha256: aeec13300ab92e14cb849d03d936ba90e47c6edb47a93a68d97c2c14436bb96b

Contents?: true

Size: 648 Bytes

Versions: 24

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  module Templates
    class ConfigurationProxy
      def initialize(callback, parent = nil)
        @callback = callback
        @parent = parent
      end

      def method_missing(method_name, *args, &block)
        if @parent && block_given?
          @callback.call(@parent, method_name, block)
        elsif @parent
          @callback.call(@parent, method_name, *args)
        elsif block_given?
          @callback.call(method_name, block)
        else
          @callback.call(method_name, *args)
        end
      end

      def respond_to_missing?
        true
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
pages_core-3.8.2 lib/pages_core/templates/configuration_proxy.rb
pages_core-3.8.1 lib/pages_core/templates/configuration_proxy.rb
pages_core-3.8.0 lib/pages_core/templates/configuration_proxy.rb
pages_core-3.7.0 lib/pages_core/templates/configuration_proxy.rb