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
72
# 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



82
83
84
# File 'lib/ridl/genfile.rb', line 82

def [](sectionid)
  @sections[(sectionid || '').to_sym]
end

#each(&block) ⇒ Object



86
87
88
# File 'lib/ridl/genfile.rb', line 86

def each(&block)
  @sections.each(&block)
end

#has_section?(sectionid) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#sectionsObject



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

def sections
  @sections.keys
end