diff --git a/lib/twine/formatters.rb b/lib/twine/formatters.rb index 0c228d6..fc0e69e 100644 --- a/lib/twine/formatters.rb +++ b/lib/twine/formatters.rb @@ -1,25 +1,13 @@ -Dir[File.join(File.dirname(__FILE__), 'formatters', '*.rb')].each do |file| - require file -end - module Twine module Formatters - @formatters = [Formatters::Apple.new, Formatters::Android.new, Formatters::Gettext.new, Formatters::JQuery.new, Formatters::Flash.new, Formatters::Django.new, Formatters::Tizen.new] + @formatters = [] class << self attr_reader :formatters - - ### - # registers a new formatter - # - # formatter_class - the class of the formatter to register - # - # returns array of active formatters - # - def register_formatter formatter_class - raise "#{formatter_class} already registered" if @formatters.include? formatter_class - @formatters << formatter_class - end end end end + +Dir[File.join(File.dirname(__FILE__), 'formatters', '*.rb')].each do |file| + require file +end diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb index beed801..640b840 100644 --- a/lib/twine/formatters/android.rb +++ b/lib/twine/formatters/android.rb @@ -135,3 +135,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::Android.new diff --git a/lib/twine/formatters/apple.rb b/lib/twine/formatters/apple.rb index d575992..7285a7e 100644 --- a/lib/twine/formatters/apple.rb +++ b/lib/twine/formatters/apple.rb @@ -111,3 +111,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::Apple.new diff --git a/lib/twine/formatters/django.rb b/lib/twine/formatters/django.rb index 2edc3c8..e9f8f93 100644 --- a/lib/twine/formatters/django.rb +++ b/lib/twine/formatters/django.rb @@ -133,3 +133,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::Django.new diff --git a/lib/twine/formatters/flash.rb b/lib/twine/formatters/flash.rb index 393d583..cf5e6f0 100644 --- a/lib/twine/formatters/flash.rb +++ b/lib/twine/formatters/flash.rb @@ -93,3 +93,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::Flash.new diff --git a/lib/twine/formatters/gettext.rb b/lib/twine/formatters/gettext.rb index 5ca2051..fb2d816 100644 --- a/lib/twine/formatters/gettext.rb +++ b/lib/twine/formatters/gettext.rb @@ -102,3 +102,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::Gettext.new diff --git a/lib/twine/formatters/jquery.rb b/lib/twine/formatters/jquery.rb index b5cac14..d467c5a 100644 --- a/lib/twine/formatters/jquery.rb +++ b/lib/twine/formatters/jquery.rb @@ -74,3 +74,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::JQuery.new diff --git a/lib/twine/formatters/tizen.rb b/lib/twine/formatters/tizen.rb index 4868c35..b7ada66 100644 --- a/lib/twine/formatters/tizen.rb +++ b/lib/twine/formatters/tizen.rb @@ -132,3 +132,5 @@ module Twine end end end + +Twine::Formatters.formatters << Twine::Formatters::Tizen.new