class Utils::Config::ConfigFile::BlockConfig
def config(name, *r, &block)
def config(name, *r, &block) self.config_settings ||= [] config_settings << name.to_sym dsl_accessor name, *r, &block self end
def inherited(modul)
def inherited(modul) modul.extend DSLKit::DSLAccessor super end
def initialize(&block)
def initialize(&block) block and instance_eval(&block) end
def to_ruby(depth = 0)
def to_ruby(depth = 0) result = '' result << ' ' * 2 * depth << "#{self.class.name[/::([^:]+)\z/, 1].underscore} do\n" for name in self.class.config_settings value = __send__(name) if value.respond_to?(:to_ruby) result << ' ' * 2 * (depth + 1) << value.to_ruby(depth + 1) else result << ' ' * 2 * (depth + 1) << "#{name} #{Array(value).map(&:inspect) * ', '}\n" end end result << ' ' * 2 * depth << "end\n" end