Class: CC::Resolv::Fixed
- Inherits:
-
Object
- Object
- CC::Resolv::Fixed
- Defined in:
- lib/cc/resolv.rb
Instance Method Summary collapse
- #each_address(name) ⇒ Object
-
#initialize(fallback) ⇒ Fixed
constructor
A new instance of Fixed.
Constructor Details
#initialize(fallback) ⇒ Fixed
Returns a new instance of Fixed.
18 19 20 21 |
# File 'lib/cc/resolv.rb', line 18 def initialize(fallback) @addresses = {} @fallback = fallback end |
Instance Method Details
#each_address(name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cc/resolv.rb', line 23 def each_address(name) if addresses.key?(name) yield addresses.fetch(name) else fallback.each_address(name) do |address| addresses[name] ||= address yield address end end end |