Class: WO::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/wo/loader.rb

Constant Summary collapse

WO_FILE_NAME =
".wo"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wo_file_path = nil) ⇒ Loader

Returns a new instance of Loader.



7
8
9
10
# File 'lib/wo/loader.rb', line 7

def initialize(wo_file_path = nil)
  @file_path = wo_file_path || repo_path
  @file_full_path = "#{@file_path}/#{WO_FILE_NAME}"
end

Instance Attribute Details

#file_full_pathObject (readonly)

Returns the value of attribute file_full_path.



5
6
7
# File 'lib/wo/loader.rb', line 5

def file_full_path
  @file_full_path
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



5
6
7
# File 'lib/wo/loader.rb', line 5

def file_path
  @file_path
end

Instance Method Details

#configObject



12
13
14
# File 'lib/wo/loader.rb', line 12

def config
  @config ||= YAML.load_file(@file_full_path)
end

#to_hObject



16
17
18
# File 'lib/wo/loader.rb', line 16

def to_h
  { url: config["url"], token: config["token"] }
end