Module: DBDiagram::Inspectable

Instance Method Summary collapse

Instance Method Details

#inspection_attributes(*attributes) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/db_diagram.rb', line 35

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