Class: Ayadn::SetNiceRank

Inherits:
Object
  • Object
show all
Defined in:
lib/ayadn/set.rb

Instance Method Summary collapse

Constructor Details

#initializeSetNiceRank

Returns a new instance of SetNiceRank.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/ayadn/set.rb', line 158

def initialize
  Settings.load_config
  Settings.get_token
  Settings.init_config
  Logs.create_logger
  unless Settings.options[:nicerank]
    Settings.options[:nicerank] = {
      threshold: 2.1,
      cache: 48,
      filter: true,
      filter_unranked: false
    }
  end
  unless Settings.options[:colors][:nicerank]
    Settings.options[:colors][:nicerank] = :cyan
  end
end

Instance Method Details

#cache(value) ⇒ Object



192
193
194
# File 'lib/ayadn/set.rb', line 192

def cache value
  Settings.options[:nicerank][:cache] = Validators.cache_range value.to_i
end

#filter(value) ⇒ Object



183
184
185
# File 'lib/ayadn/set.rb', line 183

def filter value
  Settings.options[:nicerank][:filter] = Validators.boolean(value)
end

#filter_unranked(value) ⇒ Object



186
187
188
# File 'lib/ayadn/set.rb', line 186

def filter_unranked value
  Settings.options[:nicerank][:filter_unranked] = Validators.boolean(value)
end

#log(args) ⇒ Object



175
176
177
178
179
# File 'lib/ayadn/set.rb', line 175

def log(args)
  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

#saveObject



180
181
182
# File 'lib/ayadn/set.rb', line 180

def save
  Settings.save_config
end

#threshold(value) ⇒ Object



189
190
191
# File 'lib/ayadn/set.rb', line 189

def threshold value
  Settings.options[:nicerank][:threshold] = Validators.threshold value
end