Class: Labelito::TemplateReader
- Inherits:
-
Object
- Object
- Labelito::TemplateReader
- Defined in:
- lib/Labelito/template_reader.rb
Instance Method Summary collapse
Instance Method Details
#read(path) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/Labelito/template_reader.rb', line 8 def read(path) raise Errors::TemplateNotFound unless File.exists?(path) puts "=> Fetching labels" YAML::load_file(path).map do |element| raise Errors::InvalidFormat unless element["name"] && element["color"] Label.new element["name"], element["color"] end end |