Module: BankScrap::Utils::Inspectable

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

Instance Method Summary collapse

Instance Method Details

#inspectObject



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