Class: Chemlab::Configuration

Inherits:
Object
  • Object
show all
Includes:
Runtime::Logger
Defined in:
lib/chemlab/configuration.rb

Overview

Chemlab Configuration

Constant Summary collapse

<<~'BANNER'

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Runtime::Logger

#log

Constructor Details

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

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:



50
51
52
53
54
55
56
57
58
59
60
# 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

Instance Attribute Details

#browserObject

Returns the value of attribute browser.



70
71
72
# File 'lib/chemlab/configuration.rb', line 70

def browser
  @browser
end

#librariesObject

Returns the value of attribute libraries.



70
71
72
# File 'lib/chemlab/configuration.rb', line 70

def libraries
  @libraries
end

Class Method Details

.add_config(name) ⇒ Object

Add a chemlab configuration



63
64
65
# File 'lib/chemlab/configuration.rb', line 63

def self.add_config(name)
  attr_accessor name
end

Instance Method Details

#configure_rspecObject

Call RSpec.configure for additional configuration



87
88
89
90
91
92
93
94
95
# 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