Class: Nutella::RunListHash

Inherits:
PersistedHash show all
Defined in:
lib/config/runlist.rb

Instance Method Summary collapse

Methods inherited from PersistedHash

#[], #[]=, #add?, #delete, #delete?, #empty?, #has_key?, #include?, #initialize, #keys, #length, #to_h, #to_s

Constructor Details

This class inherits a constructor from Nutella::PersistedHash

Instance Method Details

#extract_run_id(run_name) ⇒ String

Extracts the run_id from the run name (specified at command line) was specified) or the concatenation of project_name and run_name

Parameters:

Returns:

  • the run_id which is either the project_name (if no run_name



19
20
21
# File 'lib/config/runlist.rb', line 19

def extract_run_id( run_name )
  run_name.to_s.empty? ? Nutella.current_project.config['name'] : "#{Nutella.current_project.config['name']}_#{run_name}"
end

#runs_by_project(project_name = nil) ⇒ Array<String>

Returns the run_id names for a certain project If no project is specified, run_ids for all projects are returned

Parameters:

  • (defaults to: nil)

    the name of the project we want to find run names for

Returns:

  • list of run_ids associated to the specified project



11
12
13
# File 'lib/config/runlist.rb', line 11

def runs_by_project( project_name=nil )
  (project_name == nil) ? keys : keys.select { |run| run.start_with?(project_name) }
end