class Ruboty::Handlers::HatenaHotentry

Constants

ARTICLE_FORMAT

Public Instance Methods

hotentry(message) click to toggle source
# File lib/ruboty/handlers/hatena_hotentry.rb, line 10
def hotentry(message)
  hotentry = ref(message[:keyword])
  message.reply(layout(hotentry)) unless hotentry.nil?
end

Private Instance Methods

layout(hotentry) click to toggle source
# File lib/ruboty/handlers/hatena_hotentry.rb, line 21
def layout(hotentry)
  String.new.tap do |s|
    s << "```\n"
    s << hotentry.collect { |v| sprintf(ARTICLE_FORMAT, v) }.join("\n")
    s << "```"
  end
end
ref(category) click to toggle source
# File lib/ruboty/handlers/hatena_hotentry.rb, line 17
def ref(category)
  Ruboty::HatenaHotentry::Client.new(category: category).get
end