module ActiveModel::LoggerAttributes
Constants
- InvalidAttributeValue
- VERSION
Public Instance Methods
define_attr_logger_attribute(attribute)
click to toggle source
ensure the attribute itself has been initialized…
# File lib/active_model/logger_attributes.rb, line 57 def define_attr_logger_attribute(attribute) instance_variable_set(:"@#{attribute}", []) unless instance_variable_get(:"@#{attribute}") return if instance_variable_get(:"@#{attribute}").respond_to?(:<<) raise InvalidAttributeValue, "invalid type for attribute #{attribute}: #{send(attribute).class}" end
logger_for_logger_attribute(attribute, logger_class) { |l| ... }
click to toggle source
# File lib/active_model/logger_attributes.rb, line 48 def logger_for_logger_attribute(attribute, logger_class, &block) device = ActiveModel::LoggerAttributes::Device.new(attribute, self) logger_class.new(device).tap do |l| l.progname = "#{self.class.name}.#{attribute}" if l.respond_to?(:progname) yield l if block_given? end end