Class: TOML::Generator

### Home Classes Methods

### In Files

- lib/toml/generator.rb

### Parent

Object

### Methods

- ::inject!
- ::new

### Files

- LICENSE

### Class/Module Index

Quicksearch

- TOML
- TOML::Generator
- TOML::Key
- TOML::Parser
- TOML::Parslet
- TOML::Table
- TOML::TableArray
- TOML::Transformer
- Array
- DateTime
- FalseClass
- Hash
- Numeric
- Object
- String
- TrueClass

No matching classes.

# TOML::Generator

### Attributes

body[R]
doc[R]

### Public Class Methods

inject!() click to toggle source

Inject to_toml methods into the Ruby classes used by TOML (booleans, String, Numeric, Array). You can add to_toml methods to your own classes to allow them to be easily serialized by the generator (and it will shout if something doesn't have a to_toml method).

    # File lib/toml/generator.rb, line 23
    def self.inject!
      return if @@injected
      require 'toml/monkey_patch'
      @@injected = true
    end

new(doc) click to toggle source

    # File lib/toml/generator.rb, line 6
    def initialize(doc)
      # Ensure all the to_toml methods are injected into the base Ruby classes
      # used by TOML.
      self.class.inject!

      @doc = doc
      @body = doc.to_toml

      return @body
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.