esp-idf-lib/devtools/spec/person_list.rb

Thu, 06 Apr 2023 13:22:03 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 06 Apr 2023 13:22:03 +0200
changeset 17
1599e696d947
parent 1
1c9894662795
permissions
-rw-r--r--

Code changes to try to fix the not working ADPS9930 driver.

# frozen_string_literal: true

require "yaml"

class PersonList
  # path to `persons.yml`
  def initialize(arg)
    @path = File.expand_path(arg)
  end

  attr_reader :path

  def load_file
    File.read(path)
  end

  def parse
    YAML.safe_load(load_file)
  end

  def metadata
    return @metadata if @metadata

    @metadata = parse
  end

  def all
    metadata
  end

  def lookup(name)
    metadata.select { |g| g["name"] == name }
  end
end

mercurial