Module: Wayfarer::Stringify::InstanceMethods

Defined in:
lib/wayfarer/stringify.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



31
32
33
34
35
36
37
38
# File 'lib/wayfarer/stringify.rb', line 31

def attributes
  self.class
      .stringified_attributes
      .map { |attr| [attr, public_send(attr)] }
      .to_h
      .map { |k, v| [k, "=", v.inspect].join }
      .join(", ")
end

#class_nameObject



27
28
29
# File 'lib/wayfarer/stringify.rb', line 27

def class_name
  self.class.name.split("::").last
end

#to_sObject Also known as: inspect



21
22
23
# File 'lib/wayfarer/stringify.rb', line 21

def to_s
  "#<#{class_name} #{attributes}>"
end