class Theatres
Constants
- USER_AGENT
Public Class Methods
Source
# File plugins/theatres.rb, line 39 def command_pattern /theatres (.+)/i end
Source
# File plugins/theatres.rb, line 31 def dispatch_command(town_text, fetch:) parsed = parse_town(town_text) return { error: parsed[:error] } if parsed[:error] reply = TheatresSearch.search(parsed[:town], fetch: fetch) { reply: reply } end
Source
# File plugins/theatres.rb, line 27 def search(town, fetch:) TheatresSearch.search(town, fetch: fetch) end
Public Instance Methods
Source
# File plugins/theatres.rb, line 52 def execute(m, town) result = self.class.dispatch_command(town, fetch: method(:fetch_html)) return themed_flood_safe_reply(m, result[:error]) if result[:error] themed_flood_safe_reply(m, result[:reply]) end
Source
# File plugins/theatres.rb, line 48 def fetch_html(url) RabbotHttp.fetch(url, user_agent: USER_AGENT) end
Source
# File plugins/theatres.rb, line 44 def search(town, fetch: method(:fetch_html)) self.class.search(town, fetch: fetch) end