Class: Addressing::LazySubdivisions
- Inherits:
-
Object
- Object
- Addressing::LazySubdivisions
- Defined in:
- lib/addressing/lazy_subdivisions.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #any? ⇒ Boolean
- #empty? ⇒ Boolean
-
#initialize(parents) ⇒ LazySubdivisions
constructor
A new instance of LazySubdivisions.
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
16 17 18 19 |
# File 'lib/addressing/lazy_subdivisions.rb', line 16 def any? do_initialize unless @initialized @subdivisions.any? end |
#empty? ⇒ Boolean
21 22 23 24 |
# File 'lib/addressing/lazy_subdivisions.rb', line 21 def empty? do_initialize unless @initialized @subdivisions.empty? end |