lib/gist_updater/updater.rb in gist_updater-0.3.0 vs lib/gist_updater/updater.rb in gist_updater-0.3.1
- old
+ new
@@ -1,16 +1,22 @@
# frozen_string_literal: true
module GistUpdater
+ # Updates according to user configuration
class Updater
+ # @param options [Hash] options generated by Thor
+ # @param config_class [Class] a Class which has configuration duty
def initialize(options, config_class = Config)
@user = options[:user] || ENV['GISTUPDATER_USER']
@access_token = options[:token] || ENV['GISTUPDATER_ACCESS_TOKEN']
@config = config_class.new(options[:yaml])
GistUpdater.debug = options[:debug]
end
+ # Update your Gist
+ #
+ # @return [Fixnum] Updated count
def update
count = 0
config.each do |gist_id:, file_paths:|
file_paths.each do |file_path|
@@ -23,9 +29,12 @@
private
attr_reader :user, :access_token, :config
+ # Update a Gist file
+ #
+ # @return (see GistUpdater::Content#update_if_need)
def update_by_gist(id, file_path)
Content.new(
user: user,
access_token: access_token,
gist_id: id,