module R18n::YamlMethods

Base methods to load translations for YAML. It is used by YAML and Rails loaders.

Public Instance Methods

detect_yaml_private_type() click to toggle source

Detect class for private type depend on YAML parser.

# File lib/r18n-core/yaml_methods.rb, line 27
def detect_yaml_private_type
  @private_type_class = ::Syck::PrivateType if defined?(Syck)
end
initialize_types() click to toggle source

Register global types in Psych

# File lib/r18n-core/yaml_methods.rb, line 32
def initialize_types
  return unless defined?(Psych)

  Filters.by_type.each_key do |type|
    next unless type.is_a? String

    # Yeah, I add R18n's types to global, send me patch if you really
    # use YAML types too ;).
    Psych.add_domain_type('yaml.org,2002', type) do |_full_type, value|
      Typed.new(type, value)
    end
  end
end