Module: ImmosquareYaml::SharedMethods

Included in:
ImmosquareYaml, Translate
Defined in:
lib/immosquare-yaml/shared_methods.rb

Constant Summary collapse

INDENT_SIZE =
2
NOTHING =
"".freeze
SPACE =
" ".freeze
NEWLINE =
"\n".freeze
SIMPLE_QUOTE =
"'".freeze
DOUBLE_QUOTE =
'"'.freeze
DOUBLE_SIMPLE_QUOTE =
"''".freeze
WEIRD_QUOTES_REGEX =
/‘|’|“|”|‛|‚|„|‟|#{Regexp.quote(DOUBLE_SIMPLE_QUOTE)}/.freeze
YML_SPECIAL_CHARS =
["-", "`", "{", "}", "|", "[", "]", ">", ":", "\"", "'", "*", "=", "%", ",", "!", "?", "&", "#", "@"].freeze
RESERVED_KEYS =
[
  "yes", "no", "on", "off", "true", "false",
  "Yes", "No", "On", "Off", "True", "False",
  "YES", "NO", "ON", "OFF", "TRUE", "FALSE"
].freeze

Instance Method Summary collapse

Instance Method Details

#deep_transform_values(hash, &block) ⇒ Object

##

Deep transform values resursively

##


22
23
24
25
26
27
28
29
30
# File 'lib/immosquare-yaml/shared_methods.rb', line 22

def deep_transform_values(hash, &block)
  hash.transform_values do |value|
    if value.is_a?(Hash)
      deep_transform_values(value, &block)
    else
      block.call(value)
    end
  end
end