Class: Strada::Adapter::YAML

Inherits:
Object
  • Object
show all
Defined in:
lib/strada/adapter/yaml.rb

Class Method Summary collapse

Class Method Details

.from(yaml) ⇒ Object

将 YAML 转换为 RUBY(HASH) 数据结构



22
23
24
25
# File 'lib/strada/adapter/yaml.rb', line 22

def from(yaml)
  require "yaml"
  ::YAML.load yaml
end

.to(hash) ⇒ Object

将 RUBY(HASH) 数据结构转换为 YAML



17
18
19
20
# File 'lib/strada/adapter/yaml.rb', line 17

def to(hash)
  require "yaml"
  ::YAML.dump hash
end