Class: Find

Inherits:
Command show all
Defined in:
lib/tagfinder/commands/find.rb

Instance Method Summary collapse

Methods inherited from Command

#unexecute

Constructor Details

#initialize(url, text) ⇒ Find

Returns a new instance of Find.



4
5
6
7
# File 'lib/tagfinder/commands/find.rb', line 4

def initialize(url, text)
  @url = url
  @text = text
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/tagfinder/commands/find.rb', line 9

def execute
  puts "Searching for #{@text} on the url #{@url}..."
  parser = Parser.new(@url)
  result = parser.find_text_in_document(@text)
  if !result.nil?
    puts result
  else
    puts "No text found."
  end
end