Module: Percy

Defined in:
lib/percy/keyword_struct.rb,
lib/percy/stats.rb,
lib/percy/logger.rb,
lib/percy/common/version.rb,
lib/percy/process_helpers.rb

Overview

A struct that only allows keyword arguments. For example, this should be used to create value objects that are returned from service methods, instead of just returning a hash.

Usage:

class Foo < Percy::KeywordStruct.new(:bar, :baz, :qux)
end

foo = Foo.new(bar: 123, baz: true)
foo.bar  # --> 123
foo.baz  # --> true
foo.qux  # --> nil
foo.fake # --> raises NoMethodError

Defined Under Namespace

Modules: Common Classes: KeywordStruct, ProcessHelpers, Stats

Class Method Summary collapse

Class Method Details

.loggerObject



5
6
7
8
9
10
# File 'lib/percy/logger.rb', line 5

def self.logger
  @logger if defined?(@logger)
  @logger ||= Logger::Syslog.new('percy', Syslog::LOG_LOCAL7)
  @logger.level = Logger::INFO if ENV['PERCY_ENV'] == 'production'
  @logger
end