Sha256: f7420a8efb35521e0a33d5119f0a8762f37bc09842be1e4ff39c4e6bb1df08a4

Contents?: true

Size: 621 Bytes

Versions: 5

Compression:

Stored size: 621 Bytes

Contents

class Array
  def to_pack_long
    self.each_with_index.inject(0){|s, item| s = s | (item[0] << (56 - (item[1] * 8))); s }
  end
  
  def full_fill(val, len)
    self.fill(val, self.length...len)
  end
end

class NilClass
  def blank?
    true
  end
end

class String
  def blank?
    self.strip.empty?
  end
end

class Object
  def blank?
    respond_to?(:empty?) ? empty? : !self
  end
end

class Integer
  def to_eight_buffer
    8.times.map{|i| (self >> (56 - 8 * i)) & 255}
  end
end

class Hash

  def fs_symbolize_keys
    defined?(super) ? super : self.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastdfs-client-2.0.0 lib/fastdfs-client/extend_core.rb
fastdfs-client-1.4.4 lib/fastdfs-client/extend_core.rb
fastdfs-client-1.4.3 lib/fastdfs-client/extend_core.rb
fastdfs-client-1.4.1 lib/fastdfs-client/extend_core.rb
fastdfs-client-1.4.0 lib/fastdfs-client/extend_core.rb