From 9e24bae3428f726800da2963a8f2695f7d4064cd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 Jan 2016 22:29:12 +0000 Subject: enable frozen_string_literal for Ruby 2.3+ There are likely yet-to-be-discovered bugs in here. Also, keeping explicit #freeze calls for 2.2 users, since most users have not migrated to 2.3, yet. --- lib/yahns/config.rb | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'lib/yahns/config.rb') diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb index 2b71fe5..5f0a2fd 100644 --- a/lib/yahns/config.rb +++ b/lib/yahns/config.rb @@ -1,6 +1,7 @@ # -*- encoding: binary -*- # Copyright (C) 2013-2015 all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true # # Implements a DSL for configuring a yahns server. # See http://yahns.yhbt.net/examples/yahns_multi.conf.rb for a full @@ -98,10 +99,10 @@ class Yahns::Config # :nodoc: %w(atfork_prepare atfork_parent atfork_child).each do |fn| eval( - %Q(def #{fn}(*args, &blk);) << - %Q( _check_in_block([:worker_processes,:app], :#{fn});) << - %Q( _add_hook(:#{fn}, block_given? ? blk : args[0]);) << - %Q(end) + "def #{fn}(*args, &blk);" \ + " _check_in_block([:worker_processes,:app], :#{fn});" \ + " _add_hook(:#{fn}, block_given? ? blk : args[0]);" \ + 'end' ) end @@ -279,10 +280,10 @@ class Yahns::Config # :nodoc: # queue parameters (Yahns::QueueEgg) %w(max_events worker_threads).each do |_v| eval( - %Q(def #{_v}(val);) << - %Q( _check_in_block(:queue, :#{_v});) << - %Q( @block.ctx.__send__("#{_v}=", _check_int(:#{_v}, val, 1));) << - %Q(end) + "def #{_v}(val);" \ + " _check_in_block(:queue, :#{_v});" \ + " @block.ctx.__send__(%Q(#{_v}=), _check_int(:#{_v}, val, 1));" \ + 'end' ) end @@ -345,10 +346,10 @@ class Yahns::Config # :nodoc: # boolean config directives for app %w(check_client_connection persistent_connections).each do |_v| eval( - %Q(def #{_v}(bool);) << - %Q( _check_in_block(:app, :#{_v});) << - %Q( @block.ctx.__send__("#{_v}=", _check_bool(:#{_v}, bool));) << - %Q(end) + "def #{_v}(bool);" \ + " _check_in_block(:app, :#{_v});" \ + " @block.ctx.__send__(%Q(#{_v}=), _check_bool(:#{_v}, bool));" \ + 'end' ) end @@ -374,10 +375,10 @@ class Yahns::Config # :nodoc: client_header_buffer_size: 1, }.each do |_v,minval| eval( - %Q(def #{_v}(val);) << - %Q( _check_in_block(:app, :#{_v});) << - %Q( @block.ctx.__send__("#{_v}=", _check_int(:#{_v}, val, #{minval}));) << - %Q(end) + "def #{_v}(val);" \ + " _check_in_block(:app, :#{_v});" \ + " @block.ctx.__send__(%Q(#{_v}=), _check_int(:#{_v}, val, #{minval}));" \ + 'end' ) end -- cgit v1.2.3-24-ge0c7