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

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

Constant Summary

Constants inherited from Rundoc::CodeCommand

NEWLINE

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.



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

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



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

def call(env = {})
  message = "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, env)

  ""
end

#hidden?Boolean

Returns:

  • (Boolean)


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

def hidden?
  true
end

#not_hidden?Boolean

Returns:

  • (Boolean)


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

def not_hidden?
  !hidden?
end

#to_md(env = {}) ⇒ Object



19
20
21
# File 'lib/rundoc/code_command/website/visit.rb', line 19

def to_md(env = {})
  ""
end