Sha256: 6097ffee894a74422f88845b2bd0438ed54a02ac571a8ce6147d44e8c96d227f
Contents?: true
Size: 744 Bytes
Versions: 3
Compression:
Stored size: 744 Bytes
Contents
# frozen_string_literal: true require 'yaml' module GistUpdater # User configuration class Config # @param file [String] a YAML file path def initialize(file) @file = file end # Calls block once for each element in config # # @yield [gist_id:, file_paths:] Gist file paths # @yieldparam gist_id [String] a Gist id # @yieldparam file_paths [Array<String>] file paths # @yieldreturn [Array] # @return [Enumerator] def each return enum_for(:each) unless block_given? config.each do |c| yield(gist_id: c.first, file_paths: c.drop(1)) end end private attr_reader :file def config @config ||= YAML.safe_load(IO.read(file)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gist_updater-0.4.6 | lib/gist_updater/config.rb |
gist_updater-0.4.5 | lib/gist_updater/config.rb |
gist_updater-0.4.4 | lib/gist_updater/config.rb |