Module: Reviser::Helpers::Criteria::Labels
- Defined in:
- lib/reviser/helpers/criteria.rb
Overview
Manage all actions for adding, updating or getting labels of Reviser. A label is a a group of words, describing the associated criterion (method).
all_files => all files of project
known Labels are in the labels.yml file.
Constant Summary collapse
- LABELS =
Path of label.yml file
'labels.yml'
Class Method Summary collapse
-
.add(meth, label) ⇒ Object
Enable to associate a label to a criterion (method).
-
.load ⇒ Object
:criterion => label.
- .populate(hash) ⇒ Object
Class Method Details
.add(meth, label) ⇒ Object
Enable to associate a label to a criterion (method). The label will be saved in the 'labels.yml' file
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/reviser/helpers/criteria.rb', line 177 def self.add meth, label res = "Create" labels = YAML.load File.read(Cfg.workspace_file LABELS) if labels.respond_to? '[]' res = "Update" if labels.key? meth labels[meth] = label File.open(LABELS, 'w') { |f| f.write labels.to_yaml } end res end |
.load ⇒ Object
:criterion => label
190 191 192 |
# File 'lib/reviser/helpers/criteria.rb', line 190 def self.load self.populate YAML.load File.read(Cfg.workspace_file LABELS) end |
.populate(hash) ⇒ Object
194 195 196 197 198 199 200 201 202 |
# File 'lib/reviser/helpers/criteria.rb', line 194 def self.populate hash labels = {} if hash.respond_to?('each') hash.each do |meth, label| labels[meth.to_sym] = label end end labels end |