lib/wl/dotwl.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Wl
  class Dotwl
    def login(login)
      File.write(token_path, login.token)
      File.chmod(0600, token_path)
    end

    def dir
      FileUtils.mkdir_p("#{Dir.home}/.wl", mode: 0700).last
    end

    def token
      File.read(token_path) rescue nil
    end

    private
    def token_path
      "#{dir}/token"
    end
  end
end