Class: WO::Loader
- Inherits:
-
Object
- Object
- WO::Loader
- Defined in:
- lib/wo/loader.rb
Constant Summary collapse
- WO_FILE_NAME =
".wo"
Instance Attribute Summary collapse
-
#file_full_path ⇒ Object
readonly
Returns the value of attribute file_full_path.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(wo_file_path = nil) ⇒ Loader
constructor
A new instance of Loader.
- #to_h ⇒ Object
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_path ⇒ Object (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_path ⇒ Object (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
#config ⇒ Object
12 13 14 |
# File 'lib/wo/loader.rb', line 12 def config @config ||= YAML.load_file(@file_full_path) end |
#to_h ⇒ Object
16 17 18 |
# File 'lib/wo/loader.rb', line 16 def to_h { url: config["url"], token: config["token"] } end |