class SO_Comment_Hellban::Hellban

Attributes

declined_flags[R]
helpful_flags[R]

Public Class Methods

new(declined_flags, helpful_flags) click to toggle source
# File lib/so-comment-hellban.rb, line 54
def initialize(declined_flags, helpful_flags)
  @declined_flags, @helpful_flags = 
    declined_flags.to_i, helpful_flags.to_i
  get_counts unless @declined_flags and @helpful_flags
end
usage() click to toggle source
# File lib/so-comment-hellban.rb, line 76
def self.usage
  warn "Usage: #{File.basename $0} <declined_flags> <helpful_flags>"
  exit 64
end
valid_args?() click to toggle source
# File lib/so-comment-hellban.rb, line 81
def self.valid_args?
  ARGV.size == 2 and
  ARGV.all? {|arg| arg.to_s =~ /^\d+$/ }
end

Public Instance Methods

report() click to toggle source
# File lib/so-comment-hellban.rb, line 60
def report
  puts '# Stack Overflow Comment-Hellban Calculator'
  puts
  puts  "  - Current Flag Weight: #{flag_weight}"
  print '  - Hellban Status: '

  if comment_hellbanned?
    puts 'You are hellbanned.'
    puts
    puts 'See http://meta.stackoverflow.com/questions/82445/comment-hellban'
    puts 'for more information.'
  else
    puts "You aren't banned...yet."
  end
end

Private Instance Methods

comment_hellbanned?() click to toggle source
# File lib/so-comment-hellban.rb, line 88
def comment_hellbanned?
  flag_weight <= 0 ? true : false
end
flag_weight() click to toggle source
# File lib/so-comment-hellban.rb, line 92
def flag_weight
  (@helpful_flags + 10) - @declined_flags
end