class JiraCommand::Config
Constants
- CONFIG_PATH_CLASS
Public Class Methods
check_exist()
click to toggle source
# File lib/jira_command/config.rb, line 22 def self.check_exist FileTest.exists?(CONFIG_PATH_CLASS) end
Public Instance Methods
clear()
click to toggle source
# File lib/jira_command/config.rb, line 34 def clear FileUtils.rm(CONFIG_PATH_CLASS) end
read()
click to toggle source
# File lib/jira_command/config.rb, line 12 def read unless FileTest.exists?(CONFIG_PATH_CLASS) puts 'please create config file first' exit 1 end file = File.read(CONFIG_PATH_CLASS) JSON.parse(file, symbolize_names: true) end
write(hash_params)
click to toggle source
# File lib/jira_command/config.rb, line 26 def write(hash_params) FileUtils.mkdir_p(CONFIG_PATH_CLASS.dirname) unless Dir.exist?(CONFIG_PATH_CLASS.dirname) File.open(CONFIG_PATH_CLASS, 'w') do |f| f.puts hash_params.to_json end end