Sha256: a3e1266227e302d54f0f4c8f743c3f8696fe4e2e7296e29bdb54ccd334429bbf
Contents?: true
Size: 473 Bytes
Versions: 22
Compression:
Stored size: 473 Bytes
Contents
module Trestle class Display def initialize(instance) @instance = instance end 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 private def display_method @display_method ||= Trestle.config.display_methods.find { |m| @instance.respond_to?(m) } || :to_s end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.6 | lib/trestle/display.rb |
trestle-0.8.5 | lib/trestle/display.rb |