Class: Ruboty::Url::Actions::Title
- Inherits:
-
Actions::Base
- Object
- Actions::Base
- Ruboty::Url::Actions::Title
- Defined in:
- lib/ruboty/url/actions/title.rb
Overview
Ruboty::Url::Actions::Title
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ruboty/url/actions/title.rb', line 8 def call url = [0] title = '' open(url) do |f| doc = Nokogiri::HTML(f) title = doc.xpath('/html/head/title').text end = [{ color: '#EEEEEE', title: title, title_link: url, }] .reply(nil, attachments: ) unless title.empty? end |