Class: Chemlab::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Attributable, Runtime::Logger
Defined in:
lib/chemlab/configuration.rb

Overview

Chemlab Configuration

Constant Summary collapse

<<~'BANNER'

                ##                                                ##
               ####                                              ####
              ######                                            ######
             #######                                           #######
             ########                                         #########
            ##########                                        #########
            ##########                                       ###########
           ############                                      ############
          ##########/------------------------------------------\#########
         ##########/  / ___| |__   ___ _ __ ___ | | __ _| |__   \#########
         #########|  | |   | '_ \ / _ \ '_ ` _ \| |/ _` | '_ \   |########
        ##########|  | |___| | | |  __/ | | | | | | (_| | |_) |  |#########
        ###########\  \____|_| |_|\___|_| |_| |_|_|\__,_|_.__/  /###########
       #############\------------------------------------------/#############
      \*********************############################********************/
      \\\********************##########################********************///
     \\\\\\******************#########################*******************//////
    \\\\\\\\******************########################******************////////
    \\\\\\\\\\*****************######################*****************//////////
   \\\\\\\\\\\\****************#####################****************/////////////
  \\\\\\\\\\\\\\\***************####################***************///////////////
  \\\\\\\\\\\\\\\\***************##################**************/////////////////
   \\\\\\\\\\\\\\\\\*************#################**************/////////////////
      \\\\\\\\\\\\\\\*************################************////////////////
         \\\\\\\\\\\\\\************##############************//////////////
           \\\\\\\\\\\\\\**********#############***********/////////////
              \\\\\\\\\\\\**********############**********////////////
                 \\\\\\\\\\\********###########*********///////////
                    \\\\\\\\\********#########********//////////
                      \\\\\\\\\*******########*******////////
                         \\\\\\\*******######******////////
                            \\\\\\*****######*****//////
                               \\\\\****####****/////
                                 \\\\***###***////
                                    \\\**##**///
                                       \****/
                                         **
BANNER

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Attributable

included

Methods included from Runtime::Logger

#log

Constructor Details

#initialize {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/chemlab/configuration.rb', line 52

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

Instance Attribute Details

#browserObject

Returns the value of attribute browser.



72
73
74
# File 'lib/chemlab/configuration.rb', line 72

def browser
  @browser
end

#librariesObject

Returns the value of attribute libraries.



72
73
74
# File 'lib/chemlab/configuration.rb', line 72

def libraries
  @libraries
end

Instance Method Details

#configure_rspecObject

Call RSpec.configure for additional configuration



89
90
91
92
93
94
95
96
97
# File 'lib/chemlab/configuration.rb', line 89

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