Class: I18nDefScanner::YAML::Visitors::ToRuby

Inherits:
YAML::Visitors::ToRuby
  • Object
show all
Defined in:
lib/i18n_def_scanner/yaml.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.createObject



74
75
76
77
78
# File 'lib/i18n_def_scanner/yaml.rb', line 74

def self.create
  class_loader = ::YAML::ClassLoader.new
  scanner = ::YAML::ScalarScanner.new(class_loader)
  YAML::Visitors::ToRuby.new(scanner, class_loader)
end

Instance Method Details

#revive_hash(hash, obj) ⇒ Object



104
105
106
107
108
109
110
111
112
113
# File 'lib/i18n_def_scanner/yaml.rb', line 104

def revive_hash(hash, obj)
  obj.children.each_slice(2) do |key_node, value_node|
    key = accept(key_node)
    val = accept(value_node)
    val = key_node.start_line + 1 unless val.is_a?(Hash)
    hash[key] = val
  end

  hash
end

#visit_I18nDefScanner_YAML_Nodes_Alias(obj) ⇒ Object



100
101
102
# File 'lib/i18n_def_scanner/yaml.rb', line 100

def visit_I18nDefScanner_YAML_Nodes_Alias(obj)
  visit_Psych_Nodes_Alias(obj)
end

#visit_I18nDefScanner_YAML_Nodes_Document(obj) ⇒ Object



92
93
94
# File 'lib/i18n_def_scanner/yaml.rb', line 92

def visit_I18nDefScanner_YAML_Nodes_Document(obj)
  visit_Psych_Nodes_Document(obj)
end

#visit_I18nDefScanner_YAML_Nodes_Mapping(obj) ⇒ Object



88
89
90
# File 'lib/i18n_def_scanner/yaml.rb', line 88

def visit_I18nDefScanner_YAML_Nodes_Mapping(obj)
  visit_Psych_Nodes_Mapping(obj)
end

#visit_I18nDefScanner_YAML_Nodes_Scalar(obj) ⇒ Object



80
81
82
# File 'lib/i18n_def_scanner/yaml.rb', line 80

def visit_I18nDefScanner_YAML_Nodes_Scalar(obj)
  visit_Psych_Nodes_Scalar(obj)
end

#visit_I18nDefScanner_YAML_Nodes_Sequence(obj) ⇒ Object



84
85
86
# File 'lib/i18n_def_scanner/yaml.rb', line 84

def visit_I18nDefScanner_YAML_Nodes_Sequence(obj)
  visit_Psych_Nodes_Sequence(obj)
end

#visit_I18nDefScanner_YAML_Nodes_Stream(obj) ⇒ Object



96
97
98
# File 'lib/i18n_def_scanner/yaml.rb', line 96

def visit_I18nDefScanner_YAML_Nodes_Stream(obj)
  visit_Psych_Nodes_Stream(obj)
end