module Tablesalt::StringableObject
Public Instance Methods
inspect()
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 13 def inspect string_for(__method__) end
to_s()
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 9 def to_s string_for(__method__) end
Private Instance Methods
attribute_string(method)
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 27 def attribute_string(method) stringable_attribute_values.map { |attribute, value| "#{attribute}=#{value.public_send(method)}" }.join(" ") end
safe_send(method)
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 35 def safe_send(method) public_send(method) rescue StandardError nil end
string_for(method)
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 23 def string_for(method) "#<#{self.class.name}#{" #{attribute_string(method)}" unless stringable_attributes.empty?}>" end
stringable_attribute_values()
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 31 def stringable_attribute_values stringable_attributes.each_with_object({}) { |attribute, result| result[attribute] = safe_send(attribute) } end
stringable_attributes()
click to toggle source
# File lib/tablesalt/stringable_object.rb, line 19 def stringable_attributes [] end