@private
The Koala logger, an instance of the standard Ruby logger, pointing to STDOUT by default. In Rails projects, you can set this to Rails.logger.
Prints a deprecation message. Each individual message will only be printed once to avoid spamming.
# File lib/koala/utils.rb, line 24 def deprecate(message) @posted_deprecations ||= [] unless @posted_deprecations.include?(message) # only include each message once Kernel.warn("#{DEPRECATION_PREFIX}#{message}") @posted_deprecations << message end end
Ensures that a hash uses symbols as opposed to strings Useful for allowing either syntax for end users
# File lib/koala/utils.rb, line 35 def symbolize_hash(hash) return hash unless hash.is_a?(Hash) hash.inject({}){ |memo,(key,value)| memo[key.to_sym] = symbolize_hash(value); memo } end