Class: EYAML::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/eyaml/util.rb

Class Method Summary collapse

Class Method Details

.ensure_binary_encoding(str) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/eyaml/util.rb', line 10

def ensure_binary_encoding(str)
  if str.encoding == Encoding::BINARY
    return str
  end

  RbNaCl::Util.hex2bin(str)
end

.pretty_yaml(some_hash) ⇒ Object



6
7
8
# File 'lib/eyaml/util.rb', line 6

def pretty_yaml(some_hash)
  some_hash.to_yaml.delete_prefix("---\n")
end