Module: Morseficator::Input
- Defined in:
- lib/morseficator/input.rb,
lib/morseficator/input/file.rb,
lib/morseficator/input/string.rb
Overview
Input factory
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.build(text: nil, file: nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/morseficator/input.rb', line 11 def build(text: nil, file: nil) raise(Error, 'Missing an input') unless text || file raise(Error, 'Chose either text or file input') if text && file if text String.new(text) else File.new(file) end end |