Class: Rundoc::CodeCommand::Website::Visit

Inherits:
Rundoc::CodeCommand show all
Defined in:
lib/rundoc/code_command/website/visit.rb

Instance Attribute Summary

Attributes inherited from Rundoc::CodeCommand

#command, #contents, #keyword, #original_args, #render_command, #render_result

Instance Method Summary collapse

Methods inherited from Rundoc::CodeCommand

#push

Constructor Details

#initialize(name:, url: nil, scroll: nil, height: 720, width: 1024, visible: false) ⇒ Visit

Returns a new instance of Visit.



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rundoc/code_command/website/visit.rb', line 3

def initialize(name: , url: nil, scroll: nil, height: 720, width: 1024, visible: false)
  @name = name
  @url  = url
  @scroll = scroll
  @driver = Driver.new(
    name: name,
    url: url,
    height: height,
    width: width,
    visible: visible
  )
  Driver.add(@name, @driver)
end

Instance Method Details

#call(env = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rundoc/code_command/website/visit.rb', line 21

def call(env = {})
  message = String.new("Visting: #{@url}")
  message << "and executing:\n#{contents}" unless contents.nil? || contents.empty?

  puts message

  @driver.visit(@url) if @url
  @driver.scroll(@scroll) if @scroll


  return "" if contents.nil? || contents.empty?
  @driver.safe_eval(contents)

  return ""
end

#hidden?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/rundoc/code_command/website/visit.rb', line 37

def hidden?
  true
end

#not_hidden?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/rundoc/code_command/website/visit.rb', line 41

def not_hidden?
  !hidden?
end

#to_md(env = {}) ⇒ Object



17
18
19
# File 'lib/rundoc/code_command/website/visit.rb', line 17

def to_md(env = {})
  ""
end