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.
45 46 47 48 |
# File 'lib/ridl/genfile.rb', line 45 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
58 59 60 |
# File 'lib/ridl/genfile.rb', line 58 def [](sectionid) @sections[(sectionid || '').to_sym] end |
#each(&block) ⇒ Object
62 63 64 |
# File 'lib/ridl/genfile.rb', line 62 def each(&block) @sections.each(&block) end |
#has_section?(sectionid) ⇒ Boolean
54 55 56 |
# File 'lib/ridl/genfile.rb', line 54 def has_section?(sectionid) @sections.has_key?((sectionid || '').to_sym) end |
#sections ⇒ Object
50 51 52 |
# File 'lib/ridl/genfile.rb', line 50 def sections @sections.keys end |