class Aio::Base::Toolkit::Chain
Public Class Methods
new()
click to toggle source
# File lib/aio/base/toolkit/hash.rb, line 5 def initialize @chain = [] end
Public Instance Methods
empty?()
click to toggle source
# File lib/aio/base/toolkit/hash.rb, line 28 def empty? @chain.empty? end
get_line()
click to toggle source
获取一条链路
# File lib/aio/base/toolkit/hash.rb, line 24 def get_line @chain.pop end
split(key, num)
click to toggle source
分裂出多条key值数组
# File lib/aio/base/toolkit/hash.rb, line 10 def split(key, num) if @chain.empty? num.times { @chain.push [key.to_s] } else last = @chain.pop tmp = ::Array.new(num) { last.clone << key } @chain.concat tmp @chain end end