Skip to content

Commit

Permalink
rdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
alaz committed Dec 20, 2016
1 parent 658fc62 commit b42f04f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/legitbot/Match.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module Legitbot
##
# Represents a bot instance match. Typical methods are
# +valid?+, +fake?+ and +detected_as+
#
class Match
def initialize(ip, resolver_config = nil)
@dns = Resolv::DNS.new(resolver_config)
Expand Down
9 changes: 9 additions & 0 deletions lib/legitbot/legitbot.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
module Legitbot
@rules = []

##
# Lookup a bot based on its signature from +User-Agent+ header.
#
# If a block given, passes the found bot to the block.
#
# Returns +nil+ if no bot found and a bot match instance
# otherwise.
# :yields: a found bot
#
def self.bot(userAgent, ip, resolver_config = nil)
bot =
@rules.select { |rule|
Expand Down

0 comments on commit b42f04f

Please sign in to comment.