Class: Resto::Translator::Factory
- Inherits:
-
Object
- Object
- Resto::Translator::Factory
- Defined in:
- lib/resto/translator/request_factory.rb,
lib/resto/translator/request_factory.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(keys) ⇒ Factory
constructor
A new instance of Factory.
Constructor Details
#initialize(keys) ⇒ Factory
Returns a new instance of Factory.
26 27 28 |
# File 'lib/resto/translator/request_factory.rb', line 26 def initialize(keys) @keys = keys end |
Class Method Details
.create(translator) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/resto/translator/request_factory.rb', line 8 def create(translator) if translator.is_a?(Symbol) and :default == translator new([]) elsif translator.is_a?(Array) new(translator) elsif translator.is_a?(Proc) translator elsif translator.is_a?(Class) translator.new else raise(ArgumentError, "Invalid argument. Valid symbol is :default. Array, Class or a Proc is also a valid translator.") end end |