Module: R18n::YamlMethods
- Included in:
- Loader::YAML
- Defined in:
- lib/r18n-core/yaml_methods.rb
Overview
Base methods to load translations for YAML. It is used by YAML and Rails loaders.
Instance Method Summary collapse
-
#detect_yaml_private_type ⇒ Object
Detect class for private type depend on YAML parser.
-
#initialize_types ⇒ Object
Register global types in Psych.
Instance Method Details
#detect_yaml_private_type ⇒ Object
Detect class for private type depend on YAML parser.
27 28 29 |
# 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 ⇒ Object
Register global types in Psych
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |