Class: Tweep::Account
Constant Summary collapse
- @@registry =
{}
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(yml, index) ⇒ Account
constructor
A new instance of Account.
- #retweet!(status_id) ⇒ Object
- #run! ⇒ Object
Constructor Details
#initialize(yml, index) ⇒ Account
Returns a new instance of Account.
22 23 24 25 26 |
# File 'lib/tweep/account.rb', line 22 def initialize(yml, index) return unless load_config(yml, index) @index = index @@registry[@config.nick] = self end |
Class Method Details
.each(&block) ⇒ Object
14 15 16 |
# File 'lib/tweep/account.rb', line 14 def self.each(&block) @@registry.values.each(&block) end |
.find(nick) ⇒ Object
18 19 20 |
# File 'lib/tweep/account.rb', line 18 def self.find(nick) @@registry[nick] end |
Instance Method Details
#retweet!(status_id) ⇒ Object
28 29 30 31 |
# File 'lib/tweep/account.rb', line 28 def retweet!(status_id) Tweep.info "#{@config.nick} retweets #{status_id.inspect}" execute :retweet, status_id end |
#run! ⇒ Object
33 34 35 36 |
# File 'lib/tweep/account.rb', line 33 def run! return unless @config.has_tweets? && @config.now_is_a_good_time? tweet! end |