Module: Sisimai::Fact::YAML

Defined in:
lib/sisimai/fact/yaml.rb

Overview

Sisimai::Fact::YAML dumps decoded data object as a YAML format. This class and method should be called from the parent object “Sisimai::Fact”.

Class Method Summary collapse

Class Method Details

.dump(argvs) ⇒ String?

Serializer (YAML)

Parameters:

Returns:

  • (String, nil)

    Dumped data or nil if the argument is missing



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sisimai/fact/yaml.rb', line 12

def dump(argvs)
  return "" if argvs.nil? || argvs.is_a?(Sisimai::Fact) == false

  damneddata = argvs.damn
  yamlstring = nil

  begin
    yamlstring = ::YAML.dump(damneddata)
  rescue StandardError => ce
    warn '***warning: Failed to YAML.dump: ' + ce.to_s
  end

  return yamlstring
end