Sha256: 28b43e5f27968e523f2d8e50862525d02f3759892c53e89f69c55d0138dbcf20
Contents?: true
Size: 655 Bytes
Versions: 6
Compression:
Stored size: 655 Bytes
Contents
require 'singleton' module Logworm class ConfigFileNotFound < Exception ; end class Config include ::Singleton FILENAME = "./.logworm" def initialize @file_found = false @url = nil begin f = File.new(FILENAME, 'r') @url = f.readline.strip @file_found = true rescue Errno::ENOENT => e end end def url @url end def file_found? @file_found and @url end def save(url) File.open(FILENAME, 'w') do |f| f.puts url end rescue Exception %x[echo '.logworm' >> .gitignore] end end end
Version data entries
6 entries across 6 versions & 1 rubygems