diff options
author | Tony Rom <thetonyrom@gmail.com> | 2018-02-01 13:35:03 +0300 |
---|---|---|
committer | Tony Rom <thetonyrom@gmail.com> | 2018-02-01 14:15:21 +0300 |
commit | 57f8b24fe2d54df4dfcc3ddcb5796e41093f0fd7 (patch) | |
tree | 52525869ef5f3cdde39ec72a8f865501c82668dd /lib/banzai | |
parent | d90d141c24228b8df6333b03d26a1723480837ba (diff) | |
download | gitlab-ce-57f8b24fe2d54df4dfcc3ddcb5796e41093f0fd7.tar.gz |
Fix minors
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/color_parser.rb | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/banzai/color_parser.rb b/lib/banzai/color_parser.rb index d96c0a1ed1f..0cd9085190c 100644 --- a/lib/banzai/color_parser.rb +++ b/lib/banzai/color_parser.rb @@ -30,21 +30,15 @@ module Banzai FORMATS = [HEX_FORMAT, RGB_FORMAT, HSL_FORMAT].freeze - class << self - # Public: Analyzes whether the String is a color code. - # - # text - The String to be parsed. - # - # Returns the recognized color String or nil if none was found. - def parse(text) - text if color_format =~ text - end + COLOR_FORMAT = /\A(#{Regexp.union(FORMATS)})\z/ix - private - - def color_format - @color_format ||= /\A(#{Regexp.union(FORMATS)})\z/ix - end + # Public: Analyzes whether the String is a color code. + # + # text - The String to be parsed. + # + # Returns the recognized color String or nil if none was found. + def self.parse(text) + text if COLOR_FORMAT =~ text end end end |