Module: Wayfarer::Stringify::InstanceMethods
- Defined in:
- lib/wayfarer/stringify.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #class_name ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Instance Method Details
#attributes ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/wayfarer/stringify.rb', line 38 def attributes self.class .stringified_attributes .map { |attr| [attr, public_send(attr)] } .to_h .map { |k, v| [k, "=", v.inspect].join } end |
#class_name ⇒ Object
34 35 36 |
# File 'lib/wayfarer/stringify.rb', line 34 def class_name self.class.name end |
#to_s ⇒ Object Also known as: inspect
24 25 26 27 28 29 30 |
# File 'lib/wayfarer/stringify.rb', line 24 def to_s if self.class.stringified_attributes.any? "#<#{class_name} #{attributes.join(', ')}>" else "#<#{class_name}>" end end |