Class: Twix

Inherits:
Object
  • Object
show all
Defined in:
lib/twix.rb

Class Method Summary collapse

Class Method Details

.initObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/twix.rb', line 10

def self.init
  config_file = File.expand_path("~") + "/.twixrc"
  twix_config = YAML.load_file(config_file)
  Twitter.configure do |config|
     config.consumer_key = twix_config['twitter']['consumer_key']
     config.consumer_secret = twix_config['twitter']['consumer_secret']
     config.oauth_token = twix_config['twitter']['oauth_token']
     config.oauth_token_secret = twix_config['twitter']['oauth_token_secret']
  end
end

.run(args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/twix.rb', line 21

def self.run(args)
  @args = args
  handle_switches
  if args.last.match(/\A@/)
    show_user_tweets(args.last)
  elsif args.last =~ /\A[0-9]+\Z/
    tweet = Twitter.status(args.last)
    execute_tweet(tweet)
  end
end