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.



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

Returns:

  • (Boolean)


54
55
56
# File 'lib/ridl/genfile.rb', line 54

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

#sectionsObject



50
51
52
# File 'lib/ridl/genfile.rb', line 50

def sections
  @sections.keys
end