Class: Trestle::Display

Inherits:
Object
  • Object
show all
Defined in:
lib/trestle/display.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ Display

Returns a new instance of Display.



3
4
5
# File 'lib/trestle/display.rb', line 3

def initialize(instance)
  @instance = instance
end

Instance Method Details

#to_sObject



7
8
9
10
11
12
13
# File 'lib/trestle/display.rb', line 7

def to_s
  if display_method != :to_s || @instance.method(display_method).source_location
    @instance.public_send(display_method)
  else
    "#{@instance.class} (##{@instance.id})"
  end
end