Module: IPAddrList::Algorithm::LinearSearch
- Includes:
- Lint
- Defined in:
- lib/ipaddr_list.rb
Overview
slow and simple. It’s for just benchmarking script.
Instance Method Summary collapse
Instance Method Details
#add(ip) ⇒ Object
79 80 81 82 83 84 |
# File 'lib/ipaddr_list.rb', line 79 def add ip unless ip.kind_of? IPAddr ip = IPAddr.new(ip.to_s) end @ip_list.push ip end |
#after_init(ip_list = []) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/ipaddr_list.rb', line 69 def after_init ip_list=[] @ip_list = ip_list.map {|item| if item.kind_of? IPAddr item else IPAddr.new(item.to_s) end } end |
#each(&block) ⇒ Object
87 88 89 |
# File 'lib/ipaddr_list.rb', line 87 def each &block @ip_list.each(&block) end |