Module: Holdify

Defined in:
lib/holdify.rb,
lib/holdify/hold.rb,
lib/holdify/store.rb,
lib/holdify/source.rb,
lib/holdify/feedback.rb

Overview

The container module

Defined Under Namespace

Classes: Feedback, Hold, Source, Store

Constant Summary collapse

VERSION =
'1.3.7'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.colorObject

Returns the value of attribute color.



18
19
20
# File 'lib/holdify.rb', line 18

def color
  @color
end

.git_diffObject

Returns the value of attribute git_diff.



18
19
20
# File 'lib/holdify.rb', line 18

def git_diff
  @git_diff
end

.pwdObject

Returns the value of attribute pwd.



18
19
20
# File 'lib/holdify.rb', line 18

def pwd
  @pwd
end

.quietObject

Returns the value of attribute quiet.



18
19
20
# File 'lib/holdify.rb', line 18

def quiet
  @quiet
end

.reconcileObject

Returns the value of attribute reconcile.



18
19
20
# File 'lib/holdify.rb', line 18

def reconcile
  @reconcile
end

.rel_pathsObject

Returns the value of attribute rel_paths.



18
19
20
# File 'lib/holdify.rb', line 18

def rel_paths
  @rel_paths
end

.store_extObject

Returns the value of attribute store_ext.



18
19
20
# File 'lib/holdify.rb', line 18

def store_ext
  @store_ext
end

Class Method Details

.persist_stores!Object



44
45
46
47
48
# File 'lib/holdify.rb', line 44

def persist_stores!
  @stores_mutex.synchronize do
    @stores&.each_value(&:persist)
  end
end

.push_fresh(test_ref) ⇒ Object



20
21
22
23
24
# File 'lib/holdify.rb', line 20

def push_fresh(test_ref)
  @fresh_mutex.synchronize do
    @fresh << test_ref
  end
end

.relativize(path) ⇒ Object



50
51
52
53
54
# File 'lib/holdify.rb', line 50

def relativize(path)
  return path unless rel_paths

  path.sub(%r{^#{pwd}/}, '')
end

.stores(path = nil) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/holdify.rb', line 36

def stores(path = nil)
  @stores_mutex.synchronize do
    return @stores unless path

    @stores[path] ||= Store.new(path)
  end
end

.warn_fresh_valuesObject



26
27
28
29
30
31
32
33
34
# File 'lib/holdify.rb', line 26

def warn_fresh_values
  return if quiet

  @fresh_mutex.synchronize do
    return if @fresh.empty?

    warn "[HOLDIFY] Fresh value held for:\n#{@fresh.uniq.sort.map { "  #{_1}" }.join("\n")}"
  end
end