Class: TTY::Config::Marshallers::HCLMarshaller

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

Overview

Responsible for marshalling content from and into HCL format

Instance Method Summary collapse

Methods included from TTY::Config::Marshaller

included

Instance Method Details

#marshal(object) ⇒ Object



18
19
20
# File 'lib/tty/config/marshallers/hcl_marshaller.rb', line 18

def marshal(object)
  Rhcl.dump(object)
end

#unmarshal(content) ⇒ Object



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

def unmarshal(content)
  return {} if content == ""

  Rhcl.parse(content)
end