mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 05:22:34 +00:00
26 lines
515 B
Ruby
26 lines
515 B
Ruby
module TAC
|
|
class Settings
|
|
attr_accessor :hostname, :port, :config
|
|
def initialize
|
|
parse(File.read(TAC::SETTINGS_PATH))
|
|
end
|
|
|
|
def parse(json)
|
|
data = JSON.parse(json, symbolize_names: true)
|
|
|
|
@hostname = data[:data][:hostname]
|
|
@port = data[:data][:port]
|
|
@config = data[:data][:config]
|
|
end
|
|
|
|
def to_json(*args)
|
|
{
|
|
data: {
|
|
hostname: @hostname,
|
|
port: @port,
|
|
config: @config,
|
|
}
|
|
}.to_json(*args)
|
|
end
|
|
end
|
|
end |