Class: IDL::GenFile::Content
- Inherits:
-
Object
- Object
- IDL::GenFile::Content
- Defined in:
- lib/ridl/genfile.rb
Instance Method Summary collapse
- #[](sectionid) ⇒ Object
- #each(&block) ⇒ Object
- #has_section?(sectionid) ⇒ Boolean
-
#initialize(sections = {}) ⇒ Content
constructor
A new instance of Content.
- #sections ⇒ Object
Constructor Details
#initialize(sections = {}) ⇒ Content
Returns a new instance of Content.
68 69 70 71 |
# File 'lib/ridl/genfile.rb', line 68 def initialize(sections = {}) # copy content map transforming all keys to symbols @sections = sections.inject({}) {|m,(k,v)| m[k.to_sym] = v; m } end |
Instance Method Details
#[](sectionid) ⇒ Object
81 82 83 |
# File 'lib/ridl/genfile.rb', line 81 def [](sectionid) @sections[(sectionid || '').to_sym] end |
#each(&block) ⇒ Object
85 86 87 |
# File 'lib/ridl/genfile.rb', line 85 def each(&block) @sections.each(&block) end |
#has_section?(sectionid) ⇒ Boolean
77 78 79 |
# File 'lib/ridl/genfile.rb', line 77 def has_section?(sectionid) @sections.has_key?((sectionid || '').to_sym) end |
#sections ⇒ Object
73 74 75 |
# File 'lib/ridl/genfile.rb', line 73 def sections @sections.keys end |