module Slatan::Affiliation::Users
Public Class Methods
get()
click to toggle source
# File lib/slatan/affiliation/users.rb, line 7 def get() @users end
get_id(name)
click to toggle source
return id of user name
@param name: user name
# File lib/slatan/affiliation/users.rb, line 17 def get_id(name) @users.each do |user| return user[:id] if user[:name] == name end nil end
get_name(id)
click to toggle source
return name of user id
@param id: user id
# File lib/slatan/affiliation/users.rb, line 26 def get_name(id) @users.each do |user| return user[:name] if user[:id] == id end nil end
is_bot?(ident)
click to toggle source
check bot or human
@return bool true: bot, false: human
# File lib/slatan/affiliation/users.rb, line 35 def is_bot?(ident) key = if is_id?(ident) then :id else :name end @users.each do |user| if user[key] == ident return user[:is_bot] end end return false end
is_id?(key)
click to toggle source
check id or name
@return bool true: id, false: name
# File lib/slatan/affiliation/users.rb, line 48 def is_id?(key) key =~ /^[A-Z0-9]+$/ end
set(users)
click to toggle source
# File lib/slatan/affiliation/users.rb, line 11 def set(users) @users = users end