class Urban
Help: Urban Dictionary slang lookup — !urban <term> — responders: all_loaded
Constants
- STYLE_TITLE
Public Class Methods
Source
# File plugins/urban.rb, line 45 def self.default_fetch(url) UrbanLookup.default_fetch(url) end
Source
# File plugins/urban.rb, line 35 def self.format_miss(term) IrcReply.card( tag: "URBAN", title: term.to_s.strip.downcase, body_lines: ["No definitions found."], footer_parts: ["Urban Dictionary"], heading_style: STYLE_TITLE ) end
Source
# File plugins/urban.rb, line 21 def self.format_reply(term, fetch: method(:default_fetch)) body = UrbanLookup.card_body(term, fetch: fetch) return format_miss(term) unless body definition = body[:line].sub(/\A#{Regexp.escape(body[:word])}\s+—\s+/i, "") IrcReply.card( tag: "URBAN", title: body[:word], body_lines: [definition], footer_parts: ["Urban Dictionary"], heading_style: STYLE_TITLE ) end
Public Instance Methods
Source
# File plugins/urban.rb, line 49 def execute(m, term) themed_flood_safe_reply(m, self.class.format_reply(term, fetch: method(:fetch_json))) end
Source
# File plugins/urban.rb, line 53 def fetch_json(url) self.class.default_fetch(url) end