lib/epub/inspector.rb in epub-parser-0.1.5 vs lib/epub/inspector.rb in epub-parser-0.1.6

- old
+ new

@@ -1,11 +1,12 @@ module EPUB module Inspector INSTANCE_VARIABLES_OPTION = {:exclude => []} + SIMPLE_TEMPLATE = "#<%{class}:%{object_id}>" def inspect_simply - "#<%{class}:%{object_id}>" % { + SIMPLE_TEMPLATE % { :class => self.class, :object_id => inspect_object_id } end @@ -22,22 +23,23 @@ "#{name}=#{value.inspect}" }.join(' ') end module PublicationModel + TEMPLATE = "#<%{class}:%{object_id} @package=%{package} %{attributes}>" class << self def included(mod) mod.__send__ :include, Inspector end end def inspect - "#<%{class}:%{object_id} @package=%{package} %{attributes}>" % { - :class => self.class, - :package => package.inspect_simply, - :object_id => inspect_object_id, - :attributes => inspect_instance_variables(exclude: [:@package]) - } + TEMPLATE % { + :class => self.class, + :package => package.inspect_simply, + :object_id => inspect_object_id, + :attributes => inspect_instance_variables(exclude: [:@package]) + } end end end end