Class: Qas::Config
- Inherits:
-
Object
- Object
- Qas::Config
- Defined in:
- lib/qas/config.rb
Overview
List all config available
Instance Method Summary collapse
- #found ⇒ Object
-
#items ⇒ Object
returns all parsed items.
- #parse(file, lang) ⇒ Object
Instance Method Details
#found ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/qas/config.rb', line 26 def found files = Pathname.new(File.join(Dir.home, '.config', 'qas')) [].tap do |x| # Check if config does not exist if a symlink files.children.each do |y| x << y if y.exist? end end end |
#items ⇒ Object
returns all parsed items
38 39 40 41 42 43 44 45 |
# File 'lib/qas/config.rb', line 38 def items {}.tap do |x| found.each do |file| lang = file.basename.sub_ext('').to_s.to_sym x[lang] = parse file, lang end end end |
#parse(file, lang) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/qas/config.rb', line 14 def parse(file, lang) [].tap do |x| CSV.read(file, headers: true).by_row.each do |project| name = project['name'] branch = project['branch'] url = URI project['url'] x << Info.new(name, branch, url, lang.to_s) end end end |