Module: Chemlab::Library
- Defined in:
- lib/chemlab/library.rb
Overview
Application Library Definition Provides accessors for :base_url
, :base_url=
base_url
will default to Chemlab’s configured base_url
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/chemlab/library.rb', line 8 def self.included(base) base.module_eval do class << self # The Base URL where this library / application exists # If you have multiple applications that Chemlab will target, # this is useful for having separate base_urls. # # @return [String] the base_url. +Chemlab.configuration.base_url+ by default if not set # # @example # Chemlab.configure do |chemlab| # A.base_url = 'https://first_app' # B.base_url = 'https://second_app' # chemlab.base_url = 'https://main_app' # # chemlab.libraries = [A, B, C] # # C.base_url #=> https://main_app # end attr_writer :base_url def base_url @base_url ||= Chemlab.configuration.base_url end end end end |