### In Files

- ini.rb

### Methods

- parse
- parse_file
- warn

### Files

- wxruby2.lib

### Class Index

Quicksearch

- Wx
- Wx::AcceleratorTable
- Wx::Animation
- Wx::App
- Wx::ArtProvider
- Wx::AuiNotebook
- Wx::Bitmap
- Wx::BusyCursor
- Wx::CheckListBox
- Wx::Choice
- Wx::ClientDC
- Wx::Clipboard
- Wx::Colour
- Wx::ComboBox
- Wx::CommandEvent
- Wx::ControlWithItems
- Wx::DC
- Wx::Event
- Wx::EvtHandler
- Wx::Font
- Wx::Grid
- Wx::HelpController
- Wx::HelpControllerHelpProvider
- Wx::HelpProvider
- Wx::HtmlHelpController
- Wx::HtmlWindow
- Wx::Icon
- Wx::IconBundle
- Wx::Image
- Wx::ImageList
- Wx::KeywordConstructor
- Wx::KeywordConstructor::ClassMethods
- Wx::ListBox
- Wx::ListCtrl
- Wx::Locale
- Wx::MediaCtrl
- Wx::Menu
- Wx::MenuItem
- Wx::Notebook
- Wx::Object
- Wx::PaintDC
- Wx::Point
- Wx::PreviewFrame
- Wx::Rect
- Wx::RichTextCtrl
- Wx::SimpleHelpProvider
- Wx::Size
- Wx::Sizer
- Wx::Sound
- Wx::StandardPaths
- Wx::TextCtrl
- Wx::TextUrlEvent
- Wx::Timer
- Wx::ToolBar
- Wx::ToolBarTool
- Wx::TreeCtrl
- Wx::Window
- Wx::XmlResource
- Rumix
- Rumix::Application
- Rumix::Config
- Rumix::Registry
- Rumix::Widget
- Rumix::Widget::CheckOptionPanel
- Rumix::Widget::OptionItem
- Rumix::Widget::OptionPanel
- Rumix::Widget::RadioOptionPanel
- Rumix::Widget::TitleText
- ROpt
- ROpt::ArgumentParser
- ROpt::ParseResult
- Uconv
- Uconv::Error
- Enumerable
- File
- Ini
- Kernel
- Module
- Object
- Pathname
- WxConstructor
- WxRubyStyleAccessors

No matching classes.

# Ini

     encoding: us-ascii

     INI File Parser

     Version: 0.1
     License: Public Domain
     Author: Dice <scl@dc.littlestar.jp>

### Constants

VERSION
  (Not documented)
VERSION_NUMBER
  (Not documented)

### Public Class Methods

parse(text, filename = self.to_s) click to toggle source

(Not documented)

    # File ini.rb, line 15
            def self.parse(text, filename = self.to_s)
                    re = {}
                    current_section = nil

                    text.each_with_index do |line, index|
                            case line.chomp
                            when /^\;/, /^\s*$/
                                    # skip (primary)
                            when /^\[(.+)\]/
                                    # section start
                                    current_section = $1
                                    if re[current_section] then
                                            self.warn(filename, index+1, "section '#{$1}' overlap")
                                    else
                                            re[current_section] = {}
                                    end

                            when /^(.+?)\s*=\s*(.*)$/
                                    # key and value
                                    if current_section then
                                            if re[current_section][$1] then
                                                    self.warn(filename, index+1, "key '#{$1}' overlap")
                                            end

                                            re[current_section][$1] = $2
                                    else
                                            self.warn(filename, index+1, "'#{$1}' is not in section")
                                    end
                            else
                                    self.warn(filename, index+1, "warning: unknown statement")
                            end
                    end

                    re
            end

parse_file(path) click to toggle source

(Not documented)

    # File ini.rb, line 51
            def self.parse_file(path)
                    self.parse(File.read(path), path.to_s)
            end

warn(filename, lineno, msg) click to toggle source

(Not documented)

    # File ini.rb, line 55
            def self.warn(filename, lineno, msg)
                    if $VERBOSE or $DEBUG then
                            $stderr.puts "#{filename}:#{lineno}: warning: #{msg}"
                    end
            end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.