Class: Yoda::Store::Registry::LocalStore

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/store/registry/local_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(on_change: nil) ⇒ LocalStore

Returns a new instance of LocalStore.

Parameters:

  • on_change (Proc, nil) (defaults to: nil)


9
10
11
# File 'lib/yoda/store/registry/local_store.rb', line 9

def initialize(on_change: nil)
  @on_change = on_change
end

Instance Attribute Details

#on_changeProc? (readonly)

Returns:

  • (Proc, nil)


6
7
8
# File 'lib/yoda/store/registry/local_store.rb', line 6

def on_change
  @on_change
end

Instance Method Details

#add_file_patch(patch) ⇒ Object

Parameters:



19
20
21
22
# File 'lib/yoda/store/registry/local_store.rb', line 19

def add_file_patch(patch)
  registry.add_registry(patch)
  on_change&.call
end

#find_file_patch(id) ⇒ Objects::Patch?

Parameters:

  • patch (String, Symbol)

Returns:



32
33
34
# File 'lib/yoda/store/registry/local_store.rb', line 32

def find_file_patch(id)
  registry.get_registry(id)
end

#registryRegistry::Index::ComposerWrapper



14
15
16
# File 'lib/yoda/store/registry/local_store.rb', line 14

def registry
  @registry ||= Registry::Index.new.wrap(Registry::Composer.new(id: :local))
end

#remove_file_patch(patch) ⇒ Object

Parameters:



25
26
27
28
# File 'lib/yoda/store/registry/local_store.rb', line 25

def remove_file_patch(patch)
  registry.remove_registry(patch)
  on_change&.call
end