# -*- coding: utf-8 -*- module Yaks module Util extend self extend Forwardable def_delegators Inflection, :singular, :singularize, :pluralize def underscore(str) str.gsub(/::/, '/') .gsub(/(? 0 context.instance_eval(&maybe_proc) else # In case it's a lambda with zero arity instance_eval fails context.instance_exec(&maybe_proc) end else maybe_proc.to_proc.() end else maybe_proc end end module Deprecated def deprecated_alias(name, actual) define_method name do |*args, &block| $stderr.puts "WARNING: #{self.class}##{name} is deprecated, use `#{actual}'. at #{caller.first}" send(actual, *args, &block) end end end end end