Sha256: 290e43a32648f8cc630c82d20191836d22101b8348f1a5dfa9f8aca1e1ba8c8f

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

require 'dry-equalizer'
require 'dry/view/value_part'

module Dry
  module View
    class NullPart < ValuePart
      def [](key)
      end

      def each(&block)
      end

      def respond_to_missing?(*)
        true
      end

      private

      def method_missing(meth, *args, &block)
        template_path = template?("#{meth}_missing")

        if template_path
          render(template_path)
        else
          nil
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-view-0.1.1 lib/dry/view/null_part.rb
dry-view-0.1.0 lib/dry/view/null_part.rb