Class: YleTf::Config::File
- Inherits:
-
Object
- Object
- YleTf::Config::File
- Defined in:
- lib/yle_tf/config/file.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ File
constructor
A new instance of File.
- #read ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ File
Returns a new instance of File.
10 11 12 |
# File 'lib/yle_tf/config/file.rb', line 10 def initialize(name) @name = name.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/yle_tf/config/file.rb', line 8 def name @name end |
Instance Method Details
#read ⇒ Object
14 15 16 17 18 19 |
# File 'lib/yle_tf/config/file.rb', line 14 def read YAML.load_file(name) || {} rescue StandardError => e Logger.fatal("Failed to load or parse configuration from '#{name}'") raise e end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/yle_tf/config/file.rb', line 21 def to_s name end |