Class: Crabfarm::Modes::Console::ConsoleDsl
Instance Method Summary
collapse
#initialize
Instance Method Details
#help ⇒ Object
43
44
45
|
# File 'lib/crabfarm/modes/console.rb', line 43
def help
puts "Ejem..."
end
|
#reload! ⇒ Object
13
14
15
16
|
# File 'lib/crabfarm/modes/console.rb', line 13
def reload!
puts "Reloading crawler source".color(:green)
super
end
|
#reset ⇒ Object
Also known as:
r
18
19
20
21
|
# File 'lib/crabfarm/modes/console.rb', line 18
def reset
puts "Resetting crawling context".color(:green)
super
end
|
#transition(_name = nil, _params = {}) ⇒ Object
Also known as:
t
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/crabfarm/modes/console.rb', line 23
def transition(_name=nil, _params={})
if _name.nil?
puts "Must provide a state name".color(:red)
return
end
begin
puts "Transitioning to #{_name.to_s.camelize} state"
output = super
puts "State changed, generated document:"
puts JSON.pretty_generate(output.doc).color(:green).gsub(/(^|\\n)/, ' ')
puts "Completed in #{output.elapsed.real} s"
rescue Exception => e
puts "#{e.to_s}".color(:red)
puts e.backtrace
end
end
|