From 8a9f6986c32d72e9c11d6d9c7299aa0f4cafb55c Mon Sep 17 00:00:00 2001 From: Mischa The Evil Date: Sun, 28 May 2017 09:41:36 +0200 Subject: [PATCH 3/4] Use stored ref. to array holding supported languages symbols via a constant. --- lib/redmine/syntax_highlighting.rb | 5 +- ruby_scope_testing.rb | 142 +++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 ruby_scope_testing.rb diff --git a/lib/redmine/syntax_highlighting.rb b/lib/redmine/syntax_highlighting.rb index 580ed68..feff4f6 100644 --- a/lib/redmine/syntax_highlighting.rb +++ b/lib/redmine/syntax_highlighting.rb @@ -64,6 +64,8 @@ module Redmine end private_class_method :retrieve_supported_languages + SUPPORTED_LANGUAGES = retrieve_supported_languages + class << self # Highlights +text+ as the content of +filename+ # Should not return line numbers nor outer pre tag @@ -79,8 +81,7 @@ module Redmine end def language_supported?(language) - supported_languages = retrieve_supported_languages - supported_languages.include?(language.to_s.downcase.to_sym) + SUPPORTED_LANGUAGES.include?(language.to_s.downcase.to_sym) rescue false end -- 1.9.1