Class: Addressing::LazySubdivisions

Inherits:
Object
  • Object
show all
Defined in:
lib/addressing/lazy_subdivisions.rb

Instance Method Summary collapse

Constructor Details

#initialize(parents) ⇒ LazySubdivisions

Returns a new instance of LazySubdivisions.



5
6
7
8
9
# File 'lib/addressing/lazy_subdivisions.rb', line 5

def initialize(parents)
  @parents = parents
  @subdivisions = {}
  @initialized = false
end

Instance Method Details

#[](key) ⇒ Object



11
12
13
14
# File 'lib/addressing/lazy_subdivisions.rb', line 11

def [](key)
  do_initialize unless @initialized
  @subdivisions[key]
end

#any?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/addressing/lazy_subdivisions.rb', line 16

def any?
  do_initialize unless @initialized
  @subdivisions.any?
end

#empty?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/addressing/lazy_subdivisions.rb', line 21

def empty?
  do_initialize unless @initialized
  @subdivisions.empty?
end