class Rounders::Matchers::Filename
Attributes
pattern[R]
Public Class Methods
new(pattern)
click to toggle source
# File lib/rounders/matchers/filename.rb, line 6 def initialize(pattern) @pattern = pattern end
Public Instance Methods
match(message)
click to toggle source
# File lib/rounders/matchers/filename.rb, line 10 def match(message) return if message.attachment? matches = message.attachments.map do |attachment| match = attachment.filename.match(pattern) match.nil? ? nil : attachment end matches.compact end