class Rrant::Handler
Public: Initializes all the necessary objects and contains configuration methods.
Public Class Methods
new()
click to toggle source
# File lib/rrant/handler.rb, line 13 def initialize @store = Store.new @unseen = false @show_images = false @bill = false end
Public Instance Methods
and()
click to toggle source
# File lib/rrant/handler.rb, line 41 def and self end
dos(min_amount = 10)
click to toggle source
Public: Fetches rants from remote API. Returns bill if amount is too high.
min_amount - Integer, how many rants we want to fetch.
Returns self.
# File lib/rrant/handler.rb, line 34 def dos(min_amount = 10) return @bill = true if min_amount > 80 remote.save(min_amount) self end
rave()
click to toggle source
Public: Finds random rant or bill and initializes output with it.
Returns instance of Rrant::Output
.
# File lib/rrant/handler.rb, line 23 def rave rant = @bill ? bill : local.unseen(@unseen).random Output.new(rant, @show_images) end
unseen(set = true)
click to toggle source
# File lib/rrant/handler.rb, line 50 def unseen(set = true) @unseen = set self end
with_images(set = true)
click to toggle source
# File lib/rrant/handler.rb, line 45 def with_images(set = true) @show_images = set self end
Private Instance Methods
local()
click to toggle source
# File lib/rrant/handler.rb, line 61 def local @local ||= Local.new(@store) end
remote()
click to toggle source
# File lib/rrant/handler.rb, line 57 def remote @remote ||= Remote.new(@store) end