class ActiveRecordAnalyzer::Reflector
Constants
- REFLECTORS
Public Class Methods
new(klass)
click to toggle source
# File lib/active_record_analyzer/reflector.rb, line 4 def initialize(klass) @klass = klass end
Public Instance Methods
reflect(attribute)
click to toggle source
Asks every reflector if they find the given attribute in the class, and returns the attribute type (if any matched).
# File lib/active_record_analyzer/reflector.rb, line 11 def reflect(attribute) reflectors.find do |reflector| reflector.has_attribute?(attribute) end.try(:attribute_type) end
reflectors()
click to toggle source
# File lib/active_record_analyzer/reflector.rb, line 17 def reflectors REFLECTORS.map { |reflector_name| find_reflector(reflector_name).new(@klass) } end
Private Instance Methods
find_reflector(reflector_name)
click to toggle source
# File lib/active_record_analyzer/reflector.rb, line 23 def find_reflector(reflector_name) "ActiveRecordAnalyzer::Reflector::#{reflector_name.to_s.classify}".constantize end