Sha256: 8b940b2bdeda03d3d77fa36ff82a83b900b649d857d439998dbcefd1ae23a2d8

Contents?: true

Size: 443 Bytes

Versions: 3

Compression:

Stored size: 443 Bytes

Contents

module Utils

  def self.number_to_buffer(num)
    8.times.map{|i| (num >> (56 - 8 * i)) & 255}
  end

  def self.array_merge(arr1, arr2)
    raise "argument must be array" unless arr1.is_a?(Array) || arr2.is_a?(Array)
    arr2.each_with_index.map{|v, i| arr1[i] = v }
    arr1
  end

  def self.symbolize_keys(obj)
    obj.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
  end

  def self.is_blank?(obj)
    obj.nil? || obj.empty?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastdfs-client-1.2.0 lib/fastdfs-client/utils.rb
fastdfs-client-1.0.2 lib/fastdfs-client/utils.rb
fastdfs-client-1.0.1 lib/fastdfs-client/utils.rb