Class: Object

Inherits:
BasicObject
Defined in:
lib/has_many_polymorphs/support_methods.rb,
lib/has_many_polymorphs/rake_task_redefine_task.rb

Instance Method Summary collapse

Instance Method Details

#_logger_debug(s) ⇒ Object

Logger shortcut.



64
65
66
67
68
69
# File 'lib/has_many_polymorphs/support_methods.rb', line 64

def _logger_debug s
  s = "** has_many_polymorphs: #{s}"
  if defined?(Rails) and Rails.respond_to?(:logger) and Rails.logger.respond_to?(:debug)
    Rails.logger.debug(s)
  end
end

#_logger_warn(s) ⇒ Object

Logger shortcut.



72
73
74
75
76
77
78
79
# File 'lib/has_many_polymorphs/support_methods.rb', line 72

def _logger_warn s
  s = "** has_many_polymorphs: #{s}"
  if defined?(Rails) and Rails.respond_to?(:logger) and Rails.logger.respond_to?(:warn)
    Rails.logger.warn(s)
  else
    $stderr.puts(s)
  end
end

#_metaclassObject

Returns the metaclass of self.



61
# File 'lib/has_many_polymorphs/support_methods.rb', line 61

def _metaclass; (class << self; self; end); end

#silentlyObject



30
31
32
33
34
# File 'lib/has_many_polymorphs/rake_task_redefine_task.rb', line 30

def silently
  stderr, stdout, $stderr, $stdout = $stderr, $stdout, StringIO.new, StringIO.new
  yield
  $stderr, $stdout = stderr, stdout
end