class Ruboty::Karma::Actions::List
Public Instance Methods
args()
click to toggle source
# File lib/ruboty/karma/actions/list.rb, line 20 def args message['args'] ? message['args'].split(/\s+/) : [] end
call()
click to toggle source
# File lib/ruboty/karma/actions/list.rb, line 5 def call key = 'karma-list' brain = message.robot.brain brain.data[key] ||= [] lists = brain.data[key].map do |user| [user, brain.data["karma-@#{user}"]] end sorted = lists.sort_by { |e| -e[1] } text = sorted.map { |e| e[0] = quiet_name(e[0]) if quiet? e.join(': ') }.join("\n") message.reply(text) end
quiet?()
click to toggle source
# File lib/ruboty/karma/actions/list.rb, line 24 def quiet? args.include?('-q') || args.include?('--quiet') end
quiet_name(name)
click to toggle source
# File lib/ruboty/karma/actions/list.rb, line 28 def quiet_name(name) name.split('').join(' ') end