Class: MultiGit::Config::Schema::Section
- Inherits:
-
Object
- Object
- MultiGit::Config::Schema::Section
- Extended by:
- Forwardable
- Defined in:
- lib/multi_git/config/schema.rb
Instance Method Summary collapse
- #any_section(&block) ⇒ Object
-
#initialize(hash) ⇒ Section
constructor
A new instance of Section.
- #nil_section ⇒ Object
- #section(key, &block) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Section
Returns a new instance of Section.
81 82 83 |
# File 'lib/multi_git/config/schema.rb', line 81 def initialize(hash) @hash = hash end |
Instance Method Details
#any_section(&block) ⇒ Object
95 96 97 98 99 |
# File 'lib/multi_git/config/schema.rb', line 95 def any_section(&block) sec = Subsection.new(@hash.default) sec.instance_eval(&block) if block_given? return sec end |
#nil_section ⇒ Object
91 92 93 |
# File 'lib/multi_git/config/schema.rb', line 91 def nil_section section(nil) end |
#section(key, &block) ⇒ Object
85 86 87 88 89 |
# File 'lib/multi_git/config/schema.rb', line 85 def section(key, &block) sec = Subsection.new(@hash.fetch(key){ @hash[key] = Hash.new(NULL)}) sec.instance_eval(&block) if block_given? return sec end |