comparison app/models/tweet.rb @ 77:fc2bc34e6d89

Don't loop if twitter0 is not configured
author nanaya <me@myconan.net>
date Sun, 26 Jun 2016 16:49:15 +0900
parents 0c023d35cd80
children 924b3a4ed3ef
comparison
equal deleted inserted replaced
76:0c023d35cd80 77:fc2bc34e6d89
32 32
33 def init_client(config_id = 0) 33 def init_client(config_id = 0)
34 @client_config_id = config_id 34 @client_config_id = config_id
35 config_hash_key = "twitter#{config_id}".to_sym 35 config_hash_key = "twitter#{config_id}".to_sym
36 36
37 return init_client(0) if $cfg[config_hash_key].nil? 37 return init_client(0) if $cfg[config_hash_key].nil? && config_id != 0
38 38
39 @client = Twitter::REST::Client.new do |config| 39 @client = Twitter::REST::Client.new do |config|
40 $cfg[config_hash_key].each do |cfg_key, cfg_value| 40 $cfg[config_hash_key].each do |cfg_key, cfg_value|
41 config.public_send("#{cfg_key}=", cfg_value) 41 config.public_send("#{cfg_key}=", cfg_value)
42 end 42 end