From c0dff3384c8e0d5d98c51d8a3c319d29236f4b9a Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 23 Jul 2016 12:56:15 +0200 Subject: [PATCH] Replace arrow constants with frozen strings These constants are only used once in the code base and constant lookup is slower than frozen strings in MRI Ruby 2.2+. --- lib/ransack/constants.rb | 3 --- lib/ransack/helpers/form_helper.rb | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ransack/constants.rb b/lib/ransack/constants.rb index b2f02c961..b9144fe49 100644 --- a/lib/ransack/constants.rb +++ b/lib/ransack/constants.rb @@ -1,8 +1,5 @@ module Ransack module Constants - ASC_ARROW = '▲'.freeze - DESC_ARROW = '▼'.freeze - OR = 'or'.freeze AND = 'and'.freeze diff --git a/lib/ransack/helpers/form_helper.rb b/lib/ransack/helpers/form_helper.rb index d2d01b5d6..8997fa1da 100644 --- a/lib/ransack/helpers/form_helper.rb +++ b/lib/ransack/helpers/form_helper.rb @@ -198,8 +198,11 @@ def no_sort_direction_specified?(dir = @current_dir) end def direction_arrow - return Constants::DESC_ARROW if @current_dir == 'desc'.freeze - Constants::ASC_ARROW + if @current_dir == 'desc'.freeze + '▼'.freeze + else + '▲'.freeze + end end def direction_text(dir)