Class: ActiveRecordAnalyzer::Reflector::Simple

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_analyzer/reflector/simple.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Simple

Returns a new instance of Simple.



2
3
4
# File 'lib/active_record_analyzer/reflector/simple.rb', line 2

def initialize(klass)
  @klass = klass
end

Instance Method Details

#attribute_typeObject



10
11
12
# File 'lib/active_record_analyzer/reflector/simple.rb', line 10

def attribute_type
  @attribute_type ||= ActiveRecordAnalyzer::Attribute::Simple
end

#attributesObject

This returns attributes which are not foreign keys (ex: :name, but not :company_id)



16
17
18
# File 'lib/active_record_analyzer/reflector/simple.rb', line 16

def attributes
  attributes_except_foreign_keys
end

#has_attribute?(attribute) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/active_record_analyzer/reflector/simple.rb', line 6

def has_attribute?(attribute)
  attributes.include?(attribute.to_sym)
end