Class: Array

### Home Classes Methods

### In Files

- lib/toml/monkey_patch.rb

### Parent

Object

### Methods

- #to_toml

### 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.

# Array

### Public Instance Methods

to_toml(path = "") click to toggle source

    # File lib/toml/monkey_patch.rb, line 54
    def to_toml(path = "")
      unless self.map(&:class).uniq.length == 1
        raise "All array values must be the same type"
      end

      if self.first.toml_table?
        toml = ""
        self.each do |val|
          toml << "\n[[#{path}]]\n"
          toml << val.to_toml(path)
        end
        return toml
      else
        "[" + self.map {|v| v.to_toml(path) }.join(",") + "]"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.