Sha256: 2893e1c659b80103e0b827cb1338a6c8d8fd36012330ac179d51573be0c2d9b8

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

module Stars
  class Client
  
    def self.load!
      favstar = Stars::Favstar.new(username)
      puts Stars::Formatter.new(favstar.recent)
    end
  
    def self.username
      File.exists?(config_path) ? File.read(config_path) : prompt_for_username
    end
  
    def self.prompt_for_username
      puts ""
      puts ""
      puts " ★   stars."
      puts ""
      puts "Type your Twitter username:"
      remember_username(gets.chomp)
    end
  
    def self.remember_username(username)
      File.open(config_path, 'w') {|f| f.write(username) }
      username
    end
  
    def self.config_path
      File.join(ENV['HOME'], '.stars')
    end
  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stars-0.1.0 lib/stars/client.rb