Class: PlatinaWorld::FileLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/platina_world/file_loader.rb

Constant Summary collapse

DEFAULT_FILE_PATH =
"./platina_world.yml".freeze
ACCEPTABLE_EXTENSIONS =
%w(.yml .yaml).freeze

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ FileLoader

Returns a new instance of FileLoader.



10
11
12
# File 'lib/platina_world/file_loader.rb', line 10

def initialize(file_path)
  @file_path = file_path
end

Instance Method Details

#loadObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/platina_world/file_loader.rb', line 14

def load
  case
  when !exist_file?
    PlatinaWorld::Logger.error(file_path_error) and abort
  when !valid_extension_type?
    PlatinaWorld::Logger.error(invalid_extion_error) and abort
  else
    file_load
  end
end