Sha256: df286c3adaad150f7148d6539470b17a6315ea209cd8e1cc9f0063334474f0af

Contents?: true

Size: 567 Bytes

Versions: 4

Compression:

Stored size: 567 Bytes

Contents

class Time

  def floor(attribute, modulo)
    actual = self.send(attribute)
    self.change(attribute => actual - actual%modulo)
  end

end

class File

  def self.suffix_basename(file, suffix)
    dirname = File.dirname(file)
    
    dirname = 
      case dirname
      when "/": "/"
      when ".": ""
      else
        dirname + "/"
      end

    extension = File.extname(file)
    dirname +
      File.basename(file, extension) +
      suffix +
      extension
  end

  def self.write(file, content)
    File.open(file, "w") { |f| f.puts content }
  end

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
albanpeignier-alsa-backup-0.0.5 lib/alsa_backup/core_ext.rb
albanpeignier-alsa-backup-0.0.6 lib/alsa_backup/core_ext.rb
albanpeignier-alsa-backup-0.0.7 lib/alsa_backup/core_ext.rb
alsa-backup-0.0.8 lib/alsa_backup/core_ext.rb