Class: Strada::Adapter::TOML

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

Class Method Summary collapse

Class Method Details

.from(toml) ⇒ Object

将 TOML 转换为 RUBY 数据结构



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

def from(toml)
  require "toml"
  ::TOML.load toml
end

.to(hash) ⇒ Object

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



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

def to(hash)
  require "toml"
  ::TOML::Generator.new(hash).body
end