Module: LoyalIpinfo::QQwryAdapter
- Defined in:
- lib/loyal_ipinfo/worker.rb
Defined Under Namespace
Modules: QQWry
Instance Method Summary collapse
Instance Method Details
#find(*args, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/loyal_ipinfo/worker.rb', line 21 def find *args, &block = ::LoyalIpinfo::ArrayUtil.(args) @qqwry_db ||= QQWry::QQWryFile.new(self.library_file_path) result = args.inject({}) do |_result, ip| _result[ip] = @qqwry_db.find(ip) _result end if block_given? block.call result end if args.any? if args.one? result[args.first] else result end else nil end end |