Module: TTY::Config::Marshallers

Included in:
TTY::Config
Defined in:
lib/tty/config/marshallers.rb,
lib/tty/config/marshallers/hcl_marshaller.rb,
lib/tty/config/marshallers/ini_marshaller.rb,
lib/tty/config/marshallers/xml_marshaller.rb,
lib/tty/config/marshallers/json_marshaller.rb,
lib/tty/config/marshallers/toml_marshaller.rb,
lib/tty/config/marshallers/yaml_marshaller.rb,
lib/tty/config/marshallers/java_props_marshaller.rb

Defined Under Namespace

Classes: HCLMarshaller, INIMarshaller, JSONMarshaller, JavaPropsMarshaller, TOMLMarshaller, XMLMarshaller, YAMLMarshaller

Constant Summary collapse

NO_EXT =
""

Instance Method Summary collapse

Instance Method Details

#extensionsObject



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

def extensions
  marshaller_registry.exts << NO_EXT
end

#marshaller_registryObject



10
11
12
# File 'lib/tty/config/marshallers.rb', line 10

def marshaller_registry
  @marshaller_registry ||= MarshallerRegistry.new
end

#marshallersObject



14
15
16
# File 'lib/tty/config/marshallers.rb', line 14

def marshallers
  marshaller_registry.objects
end

#register_marshaller(name, object) ⇒ Object



26
27
28
# File 'lib/tty/config/marshallers.rb', line 26

def register_marshaller(name, object)
  marshaller_registry.register(name, object)
end

#registered_marshaller?(name_or_object) ⇒ Boolean

Returns:

  • (Boolean)


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

def registered_marshaller?(name_or_object)
  marshaller_registry.registered?(name_or_object)
end

#unregister_marshaller(*names) ⇒ Object



30
31
32
# File 'lib/tty/config/marshallers.rb', line 30

def unregister_marshaller(*names)
  names.map { |name| marshaller_registry.unregister(name) }
end