Class: TTY::Config::Marshallers::INIMarshaller

Inherits:
Object
  • Object
show all
Includes:
TTY::Config::Marshaller
Defined in:
lib/tty/config/marshallers/ini_marshaller.rb

Overview

Responsible for marshalling content from and into INI format

Instance Method Summary collapse

Methods included from TTY::Config::Marshaller

included

Instance Method Details

#marshal(object) ⇒ Object



19
20
21
# File 'lib/tty/config/marshallers/ini_marshaller.rb', line 19

def marshal(object)
  TTY::Config::Generator.generate(object)
end

#unmarshal(content) ⇒ Object



23
24
25
26
27
# File 'lib/tty/config/marshallers/ini_marshaller.rb', line 23

def unmarshal(content)
  ini = IniFile.new(content: content).to_h
  global = ini.delete("global") { {} }
  ini.merge(global)
end