Class: PlaywrightRails::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/playwright-rails/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir: Env.fetch("PLAYWRIGHT_RAILS_DIR", default: Dir.pwd), host: Env.fetch("PLAYWRIGHT_RAILS_HOST", default: "127.0.0.1"), port: Env.fetch("PLAYWRIGHT_RAILS_PORT"), base_path: Env.fetch("PLAYWRIGHT_RAILS_BASE_PATH", default: "/"), transactional_server: Env.fetch("PLAYWRIGHT_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true), playwright_cli_opts: Env.fetch("PLAYWRIGHT_RAILS_PLAYWRIGHT_OPTS", default: "")) ⇒ Config

Returns a new instance of Config.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/playwright-rails/config.rb', line 14

def initialize(
  dir: Env.fetch("PLAYWRIGHT_RAILS_DIR", default: Dir.pwd),
  host: Env.fetch("PLAYWRIGHT_RAILS_HOST", default: "127.0.0.1"),
  port: Env.fetch("PLAYWRIGHT_RAILS_PORT"),
  base_path: Env.fetch("PLAYWRIGHT_RAILS_BASE_PATH", default: "/"),
  transactional_server: Env.fetch("PLAYWRIGHT_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true),
  playwright_cli_opts: Env.fetch("PLAYWRIGHT_RAILS_PLAYWRIGHT_OPTS", default: "")
)
  @dir = dir
  @host = host
  @port = port
  @base_path = base_path
  @transactional_server = transactional_server
  @playwright_cli_opts = playwright_cli_opts
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



5
6
7
# File 'lib/playwright-rails/config.rb', line 5

def base_path
  @base_path
end

#dirObject

Returns the value of attribute dir.



5
6
7
# File 'lib/playwright-rails/config.rb', line 5

def dir
  @dir
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/playwright-rails/config.rb', line 5

def host
  @host
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/playwright-rails/config.rb', line 5

def port
  @port
end

#transactional_serverObject

Returns the value of attribute transactional_server.



5
6
7
# File 'lib/playwright-rails/config.rb', line 5

def transactional_server
  @transactional_server
end

Instance Method Details

#to_sObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/playwright-rails/config.rb', line 30

def to_s
  <<~DESC

    playwright-rails configuration:
    ============================
     PLAYWRIGHT_RAILS_DIR.....................#{dir.inspect}
     PLAYWRIGHT_RAILS_HOST....................#{host.inspect}
     PLAYWRIGHT_RAILS_PORT....................#{port.inspect}
     PLAYWRIGHT_RAILS_BASE_PATH...............#{base_path.inspect}
     PLAYWRIGHT_RAILS_TRANSACTIONAL_SERVER....#{transactional_server.inspect}
     PLAYWRIGHT_RAILS_PLAYWRIGHT_OPTS............#{playwright_cli_opts.inspect}

  DESC
end