Class: GistUpdater::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/gist_updater/config.rb

Overview

User configuration

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Config

Returns a new instance of Config.

Parameters:

  • file (String)

    a YAML file path



9
10
11
# File 'lib/gist_updater/config.rb', line 9

def initialize(file)
  @file = file
end

Instance Method Details

#each {|gist_id:, file_paths:| ... } ⇒ Enumerator

Calls block once for each element in config

Yields:

  • (gist_id:, file_paths:)

    Gist file paths

Yield Parameters:

  • gist_id (String)

    a Gist id

  • file_paths (Array<String>)

    file paths

Yield Returns:

  • (Array)

Returns:

  • (Enumerator)


20
21
22
23
24
25
26
# File 'lib/gist_updater/config.rb', line 20

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