Sha256: ea28310ee44daf38d063cce68c526861a5b139402d4317a1ed687ca0e8af485b

Contents?: true

Size: 1015 Bytes

Versions: 28

Compression:

Stored size: 1015 Bytes

Contents

class String
  
   def integer?
                     
     res = true
      
     begin
       r=Integer(self)
     rescue
       res=false
     end
     
     return res
   end
   
   def decamelize 
        self.to_s. 
          gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2'). 
          gsub(/([a-z]+)([A-Z\d])/, '\1_\2'). 
          gsub(/([A-Z]{2,})(\d+)/i, '\1_\2'). 
          gsub(/(\d+)([a-z])/i, '\1_\2'). 
          gsub(/(.+?)\&(.+?)/, '\1_&_\2'). 
          gsub(/\s/, '_').downcase 
   end
  
end

class File
  
  def self.is_zip?(file_path)
    res=false
    begin
      f=File.open(file_path,'rb')
      head=f.read(4)
      f.close
      res=(head=="PK\x03\x04")
    rescue
      res=false
    end
    
    return res
  end
  
  def self.unzip(file_path)
    unzipped=`unzip "#{file_path}"`
    file_list = unzipped.split("\n")
    list=[]
    
    # select only the files, not folders
    list=file_list.select{|e| e=~/inflating/}.map{|e| e.gsub('inflating:','').strip}
    
    return list
  end
  
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
seqtrimnext-2.0.68 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.66 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.62 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.61 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.60 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.59 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.57 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.56 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.55 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.54 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.52 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.51 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.50 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.49 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.48 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.46 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.45 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.42 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.41 lib/seqtrimnext/utils/string_utils.rb
seqtrimnext-2.0.39 lib/seqtrimnext/utils/string_utils.rb