Class: Librarian::Mock::Source::Mock::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/librarian/mock/source/mock/registry.rb

Defined Under Namespace

Modules: Dsl

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



61
62
63
# File 'lib/librarian/mock/source/mock/registry.rb', line 61

def initialize
  clear!
end

Instance Method Details

#[](name) ⇒ Object



71
72
73
# File 'lib/librarian/mock/source/mock/registry.rb', line 71

def [](name)
  sources[name] ||= {}
end

#clear!Object



64
65
66
# File 'lib/librarian/mock/source/mock/registry.rb', line 64

def clear!
  self.sources = { }
end

#merge!(options = nil, &block) ⇒ Object



67
68
69
70
# File 'lib/librarian/mock/source/mock/registry.rb', line 67

def merge!(options = nil, &block)
  clear! if options && options[:clear]
  Dsl.run!(sources, &block) if block
end