File: toml.rb

package info (click to toggle)
ruby-asetus 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 108 kB
  • sloc: ruby: 248; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 409 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Asetus

  def to_toml config
    Adapter::TOML.to config._asetus_to_hash
  end

  def from_toml toml
    Adapter::TOML.from toml
  end

  class Adapter
    class TOML
      class << self
        def to hash
          require 'toml'
          ::TOML::Generator.new(hash).body
        end

        def from toml
          require 'toml'
          ::TOML.load toml
        end
      end
    end
  end

end