class Chemlab::Configuration

Chemlab Configuration

Constants

Chemlab Terminal Banner

Attributes

browser[R]
libraries[R]

Public Class Methods

add_config(name) click to toggle source

Add a chemlab configuration

# File lib/chemlab/configuration.rb, line 63
def self.add_config(name)
  attr_accessor name
end
new() { |self| ... } click to toggle source
# File lib/chemlab/configuration.rb, line 50
    def initialize
      yield self if block_given?

      log(BANNER, :begn) unless hide_banner
      log(<<-CONF, :conf)

      ==> Base URL: #{base_url}
      ==> Browser: #{browser}
      ==> Libraries: #{libraries}
      CONF
    end

Public Instance Methods

browser=(browser) click to toggle source

Set the browser and browser arguments Chemlab should use

# File lib/chemlab/configuration.rb, line 73
def browser=(browser)
  @browser = Runtime::Browser.new(browser)
end
configure_rspec() { |rspec| ... } click to toggle source

Call RSpec.configure for additional configuration

# File lib/chemlab/configuration.rb, line 87
def configure_rspec
  RSpec.configure do |rspec|
    yield rspec if block_given?

    rspec.after(:each) do
      Chemlab.configuration.browser&.session&.engine&.quit
    end
  end
end
libraries=(libraries = []) click to toggle source

Specify which libraries to load

# File lib/chemlab/configuration.rb, line 78
def libraries=(libraries = [])
  @libraries = Chemlab.const_set('Vendor', Module.new)

  libraries.each do |library|
    @libraries.const_set(library.to_s, library)
  end
end