lib/ayadn/set.rb in ayadn-1.2.5 vs lib/ayadn/set.rb in ayadn-1.2.6
- old
+ new
@@ -161,11 +161,12 @@
Settings.init_config
Logs.create_logger
unless Settings.options[:nicerank]
Settings.options[:nicerank] = {
threshold: 2,
- filter: false,
+ cache: 48,
+ filter: true,
filter_unranked: false
}
end
unless Settings.options[:colors][:nicerank]
Settings.options[:colors][:nicerank] = :cyan
@@ -186,10 +187,13 @@
Settings.options[:nicerank][:filter_unranked] = Validators.boolean(value)
end
def threshold value
Settings.options[:nicerank][:threshold] = value.to_f
end
+ def cache value
+ Settings.options[:nicerank][:cache] = Validators.cache_range value.to_i
+ end
end
class SetBackup
def initialize
Settings.load_config
@@ -236,10 +240,17 @@
x
else
abort(Status.must_be_integer)
end
end
+ def self.cache_range value
+ if value >= 3 && value <= 720
+ value.round
+ else
+ abort(Status.cache_range)
+ end
+ end
def self.timer(t)
t = t.to_i
t >= 1 ? t : 3
end
def self.color(color)
@@ -364,11 +375,11 @@
Settings.options[:timeline][:show_date] = value
end
def show_nicerank value
unless Settings.options[:nicerank]
Settings.options[:nicerank] = {
- threshold: 2.1,
- filter: false,
+ threshold: 2,
+ filter: true,
filter_unranked: false
}
end
unless Settings.options[:colors][:nicerank]
Settings.options[:colors][:nicerank] = :cyan