Sha256: f80d942c409d46fa72a81a73d03f1887d3354036d2002178614eced11df127fd
Contents?: true
Size: 825 Bytes
Versions: 12
Compression:
Stored size: 825 Bytes
Contents
module RailsConnector module Authenticable def self.included(mod) %w(logged_in? admin? current_user).each do |method_name| unless instance_method_defined?(mod, method_name) mod.class_eval do private define_method(method_name, InstanceMethods.method(method_name).to_proc) end end mod.send(:helper_method, method_name) end end module InstanceMethods def self.logged_in?; false; end def self.admin?; false; end def self.current_user; nil; end end private def self.instance_method_defined?(mod, method_name) mod.instance_methods.include?(method_name) or mod.protected_instance_methods.include?(method_name) or mod.private_instance_methods.include?(method_name) end end end
Version data entries
12 entries across 12 versions & 1 rubygems