Class: Cumuliform::Section Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cumuliform/section.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, imports) ⇒ Section

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Section.



6
7
8
9
10
# File 'lib/cumuliform/section.rb', line 6

def initialize(name, imports)
  @name = name
  @imports = imports
  @items = {}
end

Instance Attribute Details

#importsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/cumuliform/section.rb', line 4

def imports
  @imports
end

#itemsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/cumuliform/section.rb', line 4

def items
  @items
end

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/cumuliform/section.rb', line 4

def name
  @name
end

Instance Method Details

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/cumuliform/section.rb', line 16

def [](name)
  merged[name]
end

#[]=(name, item) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/cumuliform/section.rb', line 12

def []=(name, item)
  items[name] = item
end

#each(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/cumuliform/section.rb', line 20

def each(&block)
  merged.each(&block)
end

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


28
29
30
# File 'lib/cumuliform/section.rb', line 28

def empty?
  merged.empty?
end

#member?(name) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


24
25
26
# File 'lib/cumuliform/section.rb', line 24

def member?(name)
  merged.member?(name)
end

#mergedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
35
36
# File 'lib/cumuliform/section.rb', line 32

def merged
  imports.reduce({}) { |merged, import|
    import.get_section(name).merged.merge(merged)
  }.merge(items)
end