lib/ayadn/set.rb in ayadn-1.3.0 vs lib/ayadn/set.rb in ayadn-1.3.1
- old
+ new
@@ -160,22 +160,22 @@
Settings.get_token
Settings.init_config
Logs.create_logger
unless Settings.options[:nicerank]
Settings.options[:nicerank] = {
- threshold: 2,
+ threshold: 2.1,
cache: 48,
filter: true,
filter_unranked: false
}
end
unless Settings.options[:colors][:nicerank]
Settings.options[:colors][:nicerank] = :cyan
end
end
def log(args)
- x = "New value for '#{args[0]}' in 'NiceRank' => #{args[1]}"
+ x = "New value for '#{args[0]}' in 'NiceRank' => #{"%1.1f" % args[1].to_f}"
puts "\n#{x}\n".color(:cyan)
Logs.rec.info x
end
def save
Settings.save_config
@@ -185,11 +185,11 @@
end
def filter_unranked value
Settings.options[:nicerank][:filter_unranked] = Validators.boolean(value)
end
def threshold value
- Settings.options[:nicerank][:threshold] = value.to_f
+ Settings.options[:nicerank][:threshold] = Validators.threshold value
end
def cache value
Settings.options[:nicerank][:cache] = Validators.cache_range value.to_i
end
end
@@ -247,10 +247,18 @@
value.round
else
abort(Status.cache_range)
end
end
+ def self.threshold value
+ value = value.to_f
+ if value > 0 and value < 5
+ value
+ else
+ abort(Status.threshold)
+ end
+ end
def self.timer(t)
t = t.to_i
t >= 1 ? t : 3
end
def self.color(color)
@@ -375,11 +383,11 @@
Settings.options[:timeline][:show_date] = value
end
def show_nicerank value
unless Settings.options[:nicerank]
Settings.options[:nicerank] = {
- threshold: 2,
+ threshold: 2.1,
filter: true,
filter_unranked: false
}
end
unless Settings.options[:colors][:nicerank]
@@ -480,8 +488,12 @@
symbols color
end
def debug(color)
Settings.options[:colors][:debug] = color.to_sym
+ end
+
+ def nicerank(color)
+ Settings.options[:colors][:nicerank] = color.to_sym
end
end
end