Module: Percy
- Defined in:
- lib/percy.rb,
lib/percy/client.rb,
lib/percy/config.rb,
lib/percy/client/builds.rb,
lib/percy/client/version.rb,
lib/percy/client/resources.rb,
lib/percy/client/snapshots.rb,
lib/percy/client/connection.rb,
lib/percy/client/environment.rb
Defined Under Namespace
Class Method Summary collapse
-
.client(options = {}) ⇒ Percy::Client
API client based on configured options.
- .config ⇒ Object
- .logger ⇒ Object
- .method_missing(method_name, *args, &block) ⇒ Object
- .reset ⇒ Object
- .respond_to?(method_name, include_private = false) ⇒ Boolean
- .respond_to_missing?(method_name, _ = false) ⇒ Boolean
Class Method Details
.client(options = {}) ⇒ Percy::Client
API client based on configured options.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/percy.rb', line 18 def self.client( = {}) if !defined?(@client) || !@client @client = Percy::Client.new( config: config, client_info: [:client_info], environment_info: [:environment_info], ) end @client end |
.config ⇒ Object
5 6 7 |
# File 'lib/percy.rb', line 5 def self.config @config ||= Percy::Config.new end |
.logger ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/percy.rb', line 31 def self.logger @logger if defined?(@logger) @logger ||= Logger.new(STDOUT) @logger.level = config.debug ? Logger::DEBUG : Logger::INFO @logger.formatter = proc do |severity, _datetime, _progname, msg| "[percy][#{severity}] #{msg}\n" end @logger end |
.method_missing(method_name, *args, &block) ⇒ Object
56 57 58 59 |
# File 'lib/percy.rb', line 56 def self.method_missing(method_name, *args, &block) return super unless client.respond_to?(method_name) client.send(method_name, *args, &block) end |
.reset ⇒ Object
9 10 11 12 13 |
# File 'lib/percy.rb', line 9 def self.reset @config = nil @client = nil @logger = nil end |
.respond_to?(method_name, include_private = false) ⇒ Boolean
50 51 52 |
# File 'lib/percy.rb', line 50 def self.respond_to?(method_name, include_private = false) client.respond_to?(method_name, include_private) || super end |
.respond_to_missing?(method_name, _ = false) ⇒ Boolean
63 64 65 |
# File 'lib/percy.rb', line 63 def self.respond_to_missing?(method_name, include_private = false) client.respond_to?(method_name, include_private) end |