class Ruboty::CanIBorrow::Actions::BorrowedHistories

Public Instance Methods

borrow_histories() click to toggle source
# File lib/ruboty/can_i_borrow/actions/borrowed_histories.rb, line 19
def borrow_histories
  leager.select{|k, v| v != nil }
end
build_message_borrow_histries() click to toggle source
# File lib/ruboty/can_i_borrow/actions/borrowed_histories.rb, line 13
def build_message_borrow_histries
  borrow_histories.map do |item, borrow_history|
    "#{borrow_history[:user]}さんが、#{borrow_history[:borrowed_at]}に#{item}を借りています。"
  end.join("\n")
end
call() click to toggle source
# File lib/ruboty/can_i_borrow/actions/borrowed_histories.rb, line 5
def call
  if borrow_histories.empty?
    message.reply("現在、誰も借りていません。")
  else
    message.reply(build_message_borrow_histries)
  end
end