fluent/fluentd — pull request #298 by tagomoris (2014-04-16 14:35:10+00:00)
Title: Configure nested sections

Extend DSL to configure parameters of plugins, to define nested sections with its parameter name/type definitions.
Add proxy object as receiver of `config_*` methods to implement this to configure recursively with config element trees.

* definition example
```ruby
# class GreatNoodleReportPlugin
config_param :name, :string, default: "frsyuki"
config_section :userinfo, required: true, multi: false do # for just 1 section
config_param :address, :string
config_param :age, :integer
config_param :admin, default: false
end
config_section :noodle, param_name: :noodles, required: false, multi: true do # for any times of sections
config_argument :name, :string # section argument NAME required (default option is also available)
config_param :cost, :integer
config_section :shop, param_name: 'shops' do # string value is also acceptable
config_argument :magazine_page do |val|
raise Fluent::ConfigError, "magazine_page argument is required" if val.nil? || val.empty?
val.to_i
end
config_param :name, :string, default: nil
config_param :stars, :integer, default: nil
end
end
```

* configuration example
```apache

type great_noodle_report
name repeatedly

address Marunouchi
age 99
admin false

cost 600

name ten-ichi
stars 5

stars 1

cost 800

stars 800

```

* ruby code to use these values
```ruby
# in plugin's instance methods
@name #=> "repeatedly"
@userinfo.age #=> 99

@noodles # Array(size 2), not "noodle" by param_name

@noodles[1].cost #=> 800
@noodles[1][:cost] #=> 800
@noodles[1].shops # Array(size 1)
@noodles[1].shops.first.stars #=> 800
```

NOTES:
* Max nest depth is not limited
* Both of v1 and traditional configuration syntax may be supported
* This patch does NOT touch internals of Parser, Element or types