medcat/liquidscript

View on GitHub
lib/liquidscript/compiler/base/blank.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Liquidscript
  module Compiler
    class Base

      # Responds to all methods with `nil`.
      class Blank

        # Respond to all methods, with `nil`.
        #
        # @return [nil]
        def method_missing(*_, &block)
          nil
        end

        # We are nil.  Yay.
        #
        # @return [true]
        def nil?
          true
        end

        # Tells Ruby that we respond to all methods.
        #
        # @return [true]
        def respond_to_missing?(_, __)
          true
        end
      end
    end
  end
end