Charyf/charyf-core

View on GitHub
lib/charyf/support/string_inquirer.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Charyf
  class StringInquirer < String
    private

    def respond_to_missing?(method_name, include_private = false)
      (method_name[-1] == "?") || super
    end

    def method_missing(method_name, *arguments)
      if method_name[-1] == "?"
        self == method_name[0..-2]
      else
        super
      end
    end
  end
end