Module: Gnucash::Support::LightInspect

Included in:
Account, AccountTransaction, Book, Customer, Gnucash::Support, Transaction, Value
Defined in:
lib/gnucash/support/light_inspect.rb

Overview

Allows lightweight inspection os Gnucash models by avoiding fetch XML nodes.

Instance Method Summary collapse

Instance Method Details

#attributesArray<Symbol>

Attributes available for inspection

Returns:

  • (Array<Symbol>)

    Attributes used to build the inspection string



9
10
11
# File 'lib/gnucash/support/light_inspect.rb', line 9

def attributes
  []
end

#inspectString

Custom implementation using only selected attributes.

Returns:

  • (String)

    Stringified version of the object

See Also:



17
18
19
20
# File 'lib/gnucash/support/light_inspect.rb', line 17

def inspect
  inspection = attributes.map { |att| "#{att}: #{send(att)}" }.join(", ")
  "#<#{self.class} #{inspection}>"
end