Sha256: 837b1ba55a1d3b38d31917f6949398b9f6e76a97919c22ba364bc3a99bc4d0e0
Contents?: true
Size: 1.02 KB
Versions: 193
Compression:
Stored size: 1.02 KB
Contents
module Trackler # Specifications is the collection of problems that we have metadata for. class Specifications include Enumerable attr_reader :root def initialize(root) @root = root end def each active.each do |specification| yield specification end end def [](slug) by_slug[slug] end # rubocop:disable Style/OpMethod def -(slugs) (by_slug.keys - slugs).sort end private def active @active ||= all.select(&:active?) end def all @all_specifications ||= exercise_slugs.map { |slug| Specification.new(slug, root) } end def exercise_slugs Dir["%s/problem-specifications/exercises/*/" % root].map { |path| File.basename(path) }.sort end def by_slug @by_slug ||= specification_map end def specification_map hash = Hash.new { |_, k| Specification.new(k, root) } active.each do |specification| hash[specification.slug] = specification end hash end end end
Version data entries
193 entries across 193 versions & 1 rubygems