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 28
def detect_yaml_private_type
  @private_type_class = if defined?(JRUBY_VERSION)
    ::YAML::Yecht::PrivateType
  elsif '1.8.' == RUBY_VERSION[0..3]
    ::YAML::PrivateType
  elsif 'syck' == ::YAML::ENGINE.yamler
    ::Syck::PrivateType
  end
end
initialize_types() click to toggle source

Register global types in Psych

# File lib/r18n-core/yaml_methods.rb, line 39
def initialize_types
  if '1.8.' != RUBY_VERSION[0..3] and 'psych' == ::YAML::ENGINE.yamler
    Filters.by_type.keys.each 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
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.