Class: GistUpdater::Updater
- Inherits:
-
Object
- Object
- GistUpdater::Updater
- Defined in:
- lib/gist_updater/updater.rb
Overview
Updates according to user configuration
Instance Method Summary collapse
-
#initialize(options, config_class = Config) ⇒ Updater
constructor
A new instance of Updater.
-
#update(content_class = Content) ⇒ Array<Sawyer::Resource>
Update your Gist.
Constructor Details
#initialize(options, config_class = Config) ⇒ Updater
Returns a new instance of Updater.
8 9 10 11 12 13 |
# File 'lib/gist_updater/updater.rb', line 8 def initialize(, config_class = Config) @user = [:user] || ENV['GISTUPDATER_USER'] @access_token = [:token] || ENV['GISTUPDATER_ACCESS_TOKEN'] @config = config_class.new([:yaml]) GistUpdater.debug = [:debug] end |
Instance Method Details
#update(content_class = Content) ⇒ Array<Sawyer::Resource>
Update your Gist
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gist_updater/updater.rb', line 19 def update(content_class = Content) updated = [] config.each do |gist_id:, file_paths:| file_paths.each do |file_path| updated << update_by_gist(gist_id, file_path, content_class) end end updated.compact end |