diff --git a/lib/awesome_print/formatter.rb b/lib/awesome_print/formatter.rb index 7dd8297..c464017 100644 --- a/lib/awesome_print/formatter.rb +++ b/lib/awesome_print/formatter.rb @@ -19,7 +19,7 @@ module AwesomePrint def format(object) @type = printable(object) @object = object - AwesomePrint::FormatterFactory.new(self, object).call + AwesomePrint::FormatterFactory.from(self, object) end # Pick the color and apply it to the given string as necessary. diff --git a/lib/awesome_print/formatter_factory.rb b/lib/awesome_print/formatter_factory.rb index 98e6346..0fc2214 100644 --- a/lib/awesome_print/formatter_factory.rb +++ b/lib/awesome_print/formatter_factory.rb @@ -3,6 +3,10 @@ require 'awesome_print/formatters' module AwesomePrint class FormatterFactory + def self.from(formatter, object) + new(formatter, object).call + end + def initialize(formatter, object) @type = AwesomePrint::TypeDiscover.new(formatter).call @class_name = @type.to_s.split('_').map(&:capitalize).join('')