Class: DK::ConfigAdapter
Instance Method Summary collapse
- #adapt ⇒ Object
-
#initialize(data, file = nil) ⇒ ConfigAdapter
constructor
A new instance of ConfigAdapter.
Constructor Details
#initialize(data, file = nil) ⇒ ConfigAdapter
Returns a new instance of ConfigAdapter.
16 17 18 19 |
# File 'lib/draftking/config.rb', line 16 def initialize(data, file = nil) super(data) @file = file end |
Instance Method Details
#adapt ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/draftking/config.rb', line 21 def adapt if @data.keys.include?('consumer_key') r = OpenStruct.new r.user_commands = [] r.api_keys = @data puts "Config #{@file} needs to be updated!" print 'Enter a name for this configuration: ' r.config_name = DK::Config.get_input Config.save_file(config: r, filename: @file) end r || @data end |