lib/epub/inspector.rb in epub-parser-0.2.5 vs lib/epub/inspector.rb in epub-parser-0.2.6
- old
+ new
@@ -23,23 +23,28 @@
"#{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
- TEMPLATE % {
+ template % {
:class => self.class,
- :package => package.inspect_simply,
+ :package => (package && package.inspect_simply),
:object_id => inspect_object_id,
:attributes => inspect_instance_variables(exclude: [:@package])
}
+ end
+
+ def template
+ t = "#<%{class}:%{object_id}"
+ t << " @package=%{package}" if package
+ t << " %{attributes}>"
end
end
end
end