Skip to content

Commit

Permalink
ToggleFetcher code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
rarruda committed Jan 9, 2019
1 parent 81a2ef3 commit aa40152
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/unleash/toggle_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize
read!
end

# once we have initialized, somewhere else you will want to start a loop with fetch()
# once initialized, somewhere else you will want to start a loop with fetch()
end

def toggles
Expand All @@ -35,7 +35,7 @@ def toggles
end

# rename to refresh_from_server! ??
# TODO: should simplify by moving uri / http initialization to class initialization
# TODO: should simplify by moving uri / http initialization to elsewhere
def fetch
Unleash.logger.debug "fetch()"
Unleash.logger.debug "ETag: #{self.etag}" unless self.etag.nil?
Expand Down Expand Up @@ -99,10 +99,6 @@ def update_client!
end
end

def backup_file_exists?
File.exists?(backup_file)
end

def save!
begin
backup_file = Unleash.configuration.backup_file
Expand All @@ -125,7 +121,7 @@ def save!

def read!
Unleash.logger.debug "read!()"
return nil unless File.exists?(Unleash.configuration.backup_file)
return nil unless File.exist?(Unleash.configuration.backup_file)

begin
file = File.open(Unleash.configuration.backup_file, "r")
Expand Down

0 comments on commit aa40152

Please sign in to comment.