Class: IDL::GenFile::Content

Inherits:
Object
  • Object
show all
Defined in:
lib/ridl/genfile.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


77
78
79
# File 'lib/ridl/genfile.rb', line 77

def has_section?(sectionid)
  @sections.has_key?((sectionid || '').to_sym)
end

#sectionsObject



73
74
75
# File 'lib/ridl/genfile.rb', line 73

def sections
  @sections.keys
end