Module: GEPUB::InspectMixin
- Defined in:
- lib/gepub/inspect_mixin.rb
Instance Method Summary collapse
-
#inspect ⇒ Object
:nocov:.
Instance Method Details
#inspect ⇒ Object
:nocov:
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gepub/inspect_mixin.rb', line 4 def inspect result = instance_variables.each .with_object({}) { |name, h| h[name] = instance_variable_get(name) } .reject { |name, value| value.nil? } .map { |name, value| case value when true, false, Symbol, Numeric, Array, Hash "#{name}=#{value.inspect}" when String if value.length > 80 "#{name}=(omitted)" else "#{name}=#{value.inspect}" end else "#{name}=#<#{value.class.name}>" end } .join(' ') "#<#{self.class.name} " + result + '>' end |