class UserAgentDB::Cli

Public Instance Methods

random() click to toggle source

@return [String]

# File lib/user_agent_db/cli.rb, line 6
def random
  `#{mac} 2>/dev/null || #{ubuntu}`.chomp
end

Private Instance Methods

db_path() click to toggle source
# File lib/user_agent_db/cli.rb, line 20
def db_path
  Pathname.new(File.dirname(__FILE__)).join('db.txt')
end
mac() click to toggle source
# File lib/user_agent_db/cli.rb, line 16
def mac
  "gshuf -n 1 #{db_path}"
end
ubuntu() click to toggle source
# File lib/user_agent_db/cli.rb, line 12
def ubuntu
  "shuf -n 1 #{db_path}"
end