Class: ActiveLoader::LoaderDispatcher
- Inherits:
-
Object
- Object
- ActiveLoader::LoaderDispatcher
- Defined in:
- lib/active_loader/loader_dispatcher.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(content, type) ⇒ LoaderDispatcher
constructor
A new instance of LoaderDispatcher.
Constructor Details
#initialize(content, type) ⇒ LoaderDispatcher
Returns a new instance of LoaderDispatcher.
5 6 7 8 |
# File 'lib/active_loader/loader_dispatcher.rb', line 5 def initialize(content, type) @content = content @type = type end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/active_loader/loader_dispatcher.rb', line 10 def call if type == :json load_json elsif [:yaml, :yml].include?(type) load_yaml else raise UnknownTypeError, "Unknown type of file: #{type}." end end |