Method: FunWith::Configurations::ConfigAPI#from_file
- Defined in:
- lib/fun_with/configurations/config_api.rb
#from_file(file) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fun_with/configurations/config_api.rb', line 13 def from_file( file ) file = file.fwf_filepath case file.ext when "rb" self.new do eval( file.read ) end when "yml", "yaml" self.from_yaml( file.read ) else warn( "Unknown filetype: #{file.ext} (file:#{file}}). Returning empty config." ) self.new end end |