Class: Doc::RootConfig

Inherits:
ConfigObject show all
Defined in:
lib/doc/root_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ConfigObject

#[], #[]=, #check_options!, #keys, #method_missing

Constructor Details

#initialize(documentor, *arguments, &block) ⇒ RootConfig

Returns a new instance of RootConfig.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/doc/root_config.rb', line 4

def initialize(documentor, *arguments, &block)
  @documentor = documentor
  super :title, *arguments, &block

  if clean_after
    if !clean_after.is_a?(Numeric)
      raise "clean_after must be a number, got #{clean_after.inspect}"
    elsif clean_after < 0
      raise "clean_after must zero or greater, got #{clean_after.inspect}"
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Doc::ConfigObject

Instance Attribute Details

#documentorObject (readonly)

Returns the value of attribute documentor.



3
4
5
# File 'lib/doc/root_config.rb', line 3

def documentor
  @documentor
end

Class Method Details

.configurator(name, klass) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/doc/root_config.rb', line 21

def self.configurator(name, klass)
  class_eval <<-RUBY, __FILE__, __LINE__
    def #{name}(*arguments, &block)
      configurators << #{klass}.new(documentor, *arguments, &block)
    end
  RUBY
end

Instance Method Details

#configuratorsObject



17
18
19
# File 'lib/doc/root_config.rb', line 17

def configurators
  @configurators ||= []
end