Sha256: 52c11484b24414dc3845fc8c0c0a3a70a3dba895634b26b271bae47eed810fe4
Contents?: true
Size: 856 Bytes
Versions: 6
Compression:
Stored size: 856 Bytes
Contents
module Her module Model module Introspection # Inspect an element, returns it for introspection. # # @example # class User # include Her::Model # end # # @user = User.find(1) # p @user # => #<User(/users/1) id=1 name="Tobias Fünke"> def inspect # {{{ "#<#{self.class}(#{self.class.build_request_path(@data)}) #{@data.inject([]) { |memo, item| key, value = item; memo << "#{key}=#{attribute_for_inspect(value)}"}.join(" ")}>" end # }}} private # @private def attribute_for_inspect(value) # {{{ if value.is_a?(String) && value.length > 50 "#{value[0..50]}...".inspect elsif value.is_a?(Date) || value.is_a?(Time) %("#{value}") else value.inspect end end # }}} end end end
Version data entries
6 entries across 6 versions & 1 rubygems