Module: RailsERD::Inspectable

Instance Method Summary collapse

Instance Method Details

#inspection_attributes(*attributes) ⇒ Object


73
74
75
76
77
78
79
80
81
82
# File 'lib/rails_erd.rb', line 73

def inspection_attributes(*attributes)
  attribute_inspection = attributes.collect { |attribute|
    " @#{attribute}=\#{[Symbol, String].include?(#{attribute}.class) ? #{attribute}.inspect : #{attribute}}"
  }.join
  class_eval <<-RUBY
    def inspect
      "#<\#{self.class}:0x%.14x#{attribute_inspection}>" % (object_id << 1)
    end
  RUBY
end