Class: Feedbook::Factories::NotifiersFactory
- Inherits:
-
Object
- Object
- Feedbook::Factories::NotifiersFactory
- Defined in:
- lib/feedbook/factories/notifiers_factory.rb
Class Method Summary collapse
-
.create(type) ⇒ Notifier
Returns instance of Notifier for given type.
Class Method Details
.create(type) ⇒ Notifier
Returns instance of Notifier for given type.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/feedbook/factories/notifiers_factory.rb', line 12 def self.create(type) case type when :null, 'null' Notifiers::NullNotifier.instance when :twitter, 'twitter' Notifiers::TwitterNotifier.instance when :facebook, 'facebook' Notifiers::FacebookNotifier.instance when :irc, 'irc' Notifiers::IRCNotifier.instance when :mail, 'mail' Notifiers::MailNotifier.instance else if Notifiers.const_defined?("#{type.capitalize}Notifier") Notifiers.const_get("#{type.capitalize}Notifier").instance elsif Notifiers.const_defined?("#{type.upcase}Notifier") Notifiers.const_get("#{type.upcase}Notifier").instance else puts "notifier #{type} is not supported by Feedbook." end end end |