Skip to content

Commit

Permalink
Merge pull request #62 from tilfin/feature/freezing
Browse files Browse the repository at this point in the history
Apply frozen_string_literal
  • Loading branch information
tilfin authored May 24, 2018
2 parents 50f2351 + fdb5ef9 commit d3f1412
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 12 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ env:
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
language: ruby
rvm:
- 2.1.2
- 2.2.3
- 2.3.4
- 2.3.0
- 2.4.1
- 2.5.0
- 2.6.0-preview1
Expand All @@ -17,7 +15,7 @@ before_script:
- chmod +x ./cc-test-reporter
script:
- bundle exec rspec
- if [ "$TRAVIS_RUBY_VERSION" == "2.4.1" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
- if [ "$TRAVIS_RUBY_VERSION" == "2.5.0" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
# In the case where travis is setup to build PR updates only,
# uncomment the line below
# - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Ougai
=====

[![Gem Version](https://badge.fury.io/rb/ougai.svg)](https://badge.fury.io/rb/ougai)
[![document](https://img.shields.io/badge/document-1.6.4-green.svg)](http://www.rubydoc.info/gems/ougai/)
[![document](https://img.shields.io/badge/document-1.7.0-green.svg)](http://www.rubydoc.info/gems/ougai/)
[![Build Status](https://travis-ci.org/tilfin/ougai.svg?branch=master)](https://travis-ci.org/tilfin/ougai)
[![Code Climate](https://codeclimate.com/github/tilfin/ougai/badges/gpa.svg)](https://codeclimate.com/github/tilfin/ougai)
[![Test Coverage](https://codeclimate.com/github/tilfin/ougai/badges/coverage.svg)](https://codeclimate.com/github/tilfin/ougai/coverage)
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/child_logger.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Ougai
# A logger created by the `child` method of parent logger
class ChildLogger
Expand Down
7 changes: 3 additions & 4 deletions lib/ougai/formatters/base.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'time'
require 'socket'

Expand Down Expand Up @@ -65,10 +67,7 @@ def format_datetime(time)
end

def default_datetime_format
t = Time.new
f = '%FT%T.%3N'
f << (t.utc? ? 'Z' : '%:z')
f.freeze
"%FT%T.%3N#{(Time.new.utc? ? 'Z' : '%:z')}"
end

def self.parse_new_params(args)
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/formatters/bunyan.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'ougai/formatters/base'

module Ougai
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/formatters/for_json.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Ougai
# The features for JSON formatter
# @attr [Boolean] jsonize Whether log should converts JSON
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/formatters/pino.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'ougai/formatters/base'

module Ougai
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/formatters/readable.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'ougai/formatters/base'

module Ougai
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/logger.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Ougai
# Main Logger
# @attr [String] default_message Use this if log message is not specified (by default this is 'No message').
Expand Down
4 changes: 3 additions & 1 deletion lib/ougai/logging.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Ougai
# Common Logging features
module Logging
Expand All @@ -8,7 +10,7 @@ module Severity
include ::Logger::Severity
TRACE = -1

SEV_LABEL = %w(TRACE DEBUG INFO WARN ERROR FATAL ANY).each(&:freeze).freeze
SEV_LABEL = %w(TRACE DEBUG INFO WARN ERROR FATAL ANY)

def to_label(severity)
SEV_LABEL[severity + 1] || 'ANY'
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/serializer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Ougai
class Serializer
def self.for_json
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/serializers/json_jr_jackson.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'jrjackson'

module Ougai::Serializers
Expand Down
2 changes: 2 additions & 0 deletions lib/ougai/serializers/json_oj.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'oj'

module Ougai::Serializers
Expand Down
4 changes: 3 additions & 1 deletion lib/ougai/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Ougai
VERSION = '1.6.6'
VERSION = '1.7.0'
end
2 changes: 1 addition & 1 deletion ougai.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.test_files = Dir['spec/**/*']
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.1.2'
spec.required_ruby_version = '>= 2.3.0'

if RUBY_PLATFORM =~ /java/
spec.platform = 'java'
Expand Down

0 comments on commit d3f1412

Please sign in to comment.