class Textp::Parser
Public Class Methods
new(text)
click to toggle source
Pass in some text and all things that can be parsed will be parsed and seperated into individual parts.
Usage:
> Parser.new
(“Meeting tomorrow at 3:30 PM.”)¶ ↑
> Parser.new
(“This embeded video is cool: youtube_link”)¶ ↑
# File lib/textp/parser.rb, line 14 def initialize(text) @text = text end
Public Instance Methods
has_links?()
click to toggle source
# File lib/textp/parser.rb, line 22 def has_links? urls = URI.extract(@text) (urls.empty?) ? false : true end
links()
click to toggle source
# File lib/textp/parser.rb, line 27 def links links = URI.extract(@text) links end
parse()
click to toggle source
# File lib/textp/parser.rb, line 18 def parse (!@text.nil?) ? @text : nil end