Class: Rdm::Source
- Inherits:
-
Object
- Object
- Rdm::Source
- Defined in:
- lib/rdm/source.rb
Instance Attribute Summary collapse
-
#config_names ⇒ Object
readonly
Returns the value of attribute config_names.
-
#package_paths ⇒ Object
readonly
Returns the value of attribute package_paths.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
-
#setup_block ⇒ Object
readonly
Returns the value of attribute setup_block.
Instance Method Summary collapse
-
#config(config_name) ⇒ Object
Add config to list of known configs.
-
#configs ⇒ Hash<String: Rdm::Config>
Read initialized configs.
-
#init_with(packages:, configs:) ⇒ Hash<String: Rdm::Package>
Init source by adding read packages and configs.
-
#initialize(root_path:) ⇒ Source
constructor
A new instance of Source.
-
#package(package_path) ⇒ Object
Add package to list of known packages.
-
#packages ⇒ Hash<String: Rdm::Package>
Read initialized packages.
-
#setup(&block) ⇒ Object
Set setup block for source.
Constructor Details
#initialize(root_path:) ⇒ Source
Returns a new instance of Source.
4 5 6 7 8 |
# File 'lib/rdm/source.rb', line 4 def initialize(root_path:) @root_path = root_path @config_names = [] @package_paths = [] end |
Instance Attribute Details
#config_names ⇒ Object (readonly)
Returns the value of attribute config_names.
2 3 4 |
# File 'lib/rdm/source.rb', line 2 def config_names @config_names end |
#package_paths ⇒ Object (readonly)
Returns the value of attribute package_paths.
2 3 4 |
# File 'lib/rdm/source.rb', line 2 def package_paths @package_paths end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
2 3 4 |
# File 'lib/rdm/source.rb', line 2 def root_path @root_path end |
#setup_block ⇒ Object (readonly)
Returns the value of attribute setup_block.
2 3 4 |
# File 'lib/rdm/source.rb', line 2 def setup_block @setup_block end |
Instance Method Details
#config(config_name) ⇒ Object
Add config to list of known configs
18 19 20 21 22 23 |
# File 'lib/rdm/source.rb', line 18 def config(config_name) config_name = config_name.to_s raise Rdm::Errors::ConfigExists, config_name if @config_names.include?(config_name) @config_names << config_name end |
#configs ⇒ Hash<String: Rdm::Config>
Read initialized configs
48 49 50 |
# File 'lib/rdm/source.rb', line 48 def configs @configs || {} end |
#init_with(packages:, configs:) ⇒ Hash<String: Rdm::Package>
Init source by adding read packages and configs
35 36 37 38 |
# File 'lib/rdm/source.rb', line 35 def init_with(packages:, configs:) @packages = packages @configs = configs end |
#package(package_path) ⇒ Object
Add package to list of known packages
27 28 29 |
# File 'lib/rdm/source.rb', line 27 def package(package_path) @package_paths << package_path end |
#packages ⇒ Hash<String: Rdm::Package>
Read initialized packages
42 43 44 |
# File 'lib/rdm/source.rb', line 42 def packages @packages || {} end |
#setup(&block) ⇒ Object
Set setup block for source
12 13 14 |
# File 'lib/rdm/source.rb', line 12 def setup(&block) @setup_block = block end |