class TTY::Config::MarshallerRegistry

Attributes

marshallers[R]

All registered marshallers

@api private

Public Class Methods

new(mappings = {}) click to toggle source

@api private

# File lib/tty/config/marshaller_registry.rb, line 12
def initialize(mappings = {})
  @marshallers = mappings
end

Public Instance Methods

[](name) click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 40
def [](name)
  marshallers.fetch(name)
end
exts() click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 24
def exts
  marshallers.values.reduce([]) { |acc, obj| acc + obj.ext }
end
names() click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 16
def names
  marshallers.keys
end
objects() click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 20
def objects
  marshallers.values
end
register(name, object) click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 32
def register(name, object)
  marshallers[name] = object
end
registered?(name_or_object) click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 28
def registered?(name_or_object)
  marshallers.key?(name_or_object) || marshallers.value?(name_or_object)
end
unregister(name) click to toggle source
# File lib/tty/config/marshaller_registry.rb, line 36
def unregister(name)
  marshallers.delete(name)
end