Module: BankScrap::Utils::Inspectable

Included in:
Account, Transaction
Defined in:
lib/bank_scrap/utils/inspectable.rb

Instance Method Summary collapse

Instance Method Details

#inspect ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bank_scrap/utils/inspectable.rb', line 4

def inspect
  attributes = inspect_attributes.reject { |x|
    begin
      attribute = send x
      !attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
    rescue NoMethodError
      true
    end
  }.map { |attribute|
    "#{attribute.to_s}: #{send(attribute).inspect}"
  }.join ' '
  "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
end