Class: FlossFunding::Library

Inherits:
Object
  • Object
show all
Includes:
FileFinder
Defined in:
lib/floss_funding/library.rb

Overview

Represents a single Library (a gem/namespace pair) that has included
FlossFunding::Poke. Holds discovery info, configuration, and env details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileFinder

#find_file_upwards, #find_last_file_upwards, root_level=, root_level?

Constructor Details

#initialize(library_name, ns, custom_ns, base_name, including_path, root_path, config_path, env_var_name, config, silent) ⇒ Library

Initialize a new Library record.

Parameters:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/floss_funding/library.rb', line 57

def initialize(library_name, ns, custom_ns, base_name, including_path, root_path, config_path, env_var_name, config, silent)
  @library_name = library_name
  @namespace = ns.name
  @base_name = base_name
  @including_path = including_path
  @env_var_name = env_var_name
  @silence = silent
  @custom_ns = custom_ns
  @library_root_path = root_path
  @library_config_path = config_path

  @config = config

  # In normal runtime we don't care about the @seen_at value, as this isn't an interactive library.
  # @seen_at is only useful for debugging; e.g., could be used to order libraries by time of discovery
  @seen_at = DEBUG ? Time.now : FlossFunding.loaded_at
  freeze
end

Instance Attribute Details

#base_nameString (readonly)

including module’s actual name

Returns:

  • (String)


21
22
23
# File 'lib/floss_funding/library.rb', line 21

def base_name
  @base_name
end

#configFlossFunding::Configuration (readonly)



38
39
40
# File 'lib/floss_funding/library.rb', line 38

def config
  @config
end

#env_var_nameString (readonly)

Returns:

  • (String)


28
29
30
# File 'lib/floss_funding/library.rb', line 28

def env_var_name
  @env_var_name
end

#including_pathString (readonly)

Returns:

  • (String)


26
27
28
# File 'lib/floss_funding/library.rb', line 26

def including_path
  @including_path
end

#library_config_pathString (readonly)

Returns:

  • (String)


32
33
34
# File 'lib/floss_funding/library.rb', line 32

def library_config_path
  @library_config_path
end

#library_nameString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/floss_funding/library.rb', line 24

def library_name
  @library_name
end

#library_root_pathString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/floss_funding/library.rb', line 30

def library_root_path
  @library_root_path
end

#namespaceString (readonly)

Namespace computed from base_name (including module’s actual name), and custom_namespace

Returns:

  • (String)


17
18
19
# File 'lib/floss_funding/library.rb', line 17

def namespace
  @namespace
end

#seen_atTime (readonly)

Returns:

  • (Time)


34
35
36
# File 'lib/floss_funding/library.rb', line 34

def seen_at
  @seen_at
end

#silenceObject (readonly)

Returns may be boolean or callable as provided.

Returns:

  • (Object)

    may be boolean or callable as provided



36
37
38
# File 'lib/floss_funding/library.rb', line 36

def silence
  @silence
end

Instance Method Details

#gem_nameObject

Convenience: gem_name used by CLI; alias to library_name for now



41
42
43
# File 'lib/floss_funding/library.rb', line 41

def gem_name
  @library_name
end