Module: CommandSetLoader
- Defined in:
- lib/helpers/command_set_loader.rb
Overview
CommandSetLoader is there to read commands from file locally for now
Class Method Summary collapse
Class Method Details
.read_commands(location = '', source = 'file', format = 'text') ⇒ Object
TODO:
Add support to load file remotely and support for different formats such as JSON
14 15 16 17 18 19 20 21 |
# File 'lib/helpers/command_set_loader.rb', line 14 def read_commands(location = '', source = 'file', format = 'text') raise Command::FormatNotSupported, 'Only text format is supported' unless format == 'text' raise Command::SourceNotSupported, 'Only file as a source is supported' unless source == 'file' raise Command::EmptyLocationProvided if location.strip == '' @location = location read_from_file end |