Module: CommandSetLoader

Defined in:
lib/helpers/command_set_loader.rb

Overview

CommandSetLoader module

Instance Method Summary collapse

Instance Method Details

#read_commands(location = '', source = 'file', format = 'text') ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/helpers/command_set_loader.rb', line 6

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