Make a constant for long inline regexp (#7810)
This commit is contained in:
parent
f2f90e98b3
commit
792721d7bc
1 changed files with 2 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
class CodesandboxTag < LiquidTagBase
|
||||
PARTIAL = "liquids/codesandbox".freeze
|
||||
OPTIONS_REGEXP = /\A(initialpath=([a-zA-Z0-9\-\_\/\.\@\%])+)\Z|\A(module=([a-zA-Z0-9\-\_\/\.\@\%])+)\Z|\A(runonclick=((0|1){1}))\Z|\Aview=(editor|split|preview)\Z/.freeze
|
||||
|
||||
def initialize(tag_name, id, tokens)
|
||||
super
|
||||
|
|
@ -48,7 +49,7 @@ class CodesandboxTag < LiquidTagBase
|
|||
# composed of letters, numbers, dashes, underscores, forward slashes, @ signs, periods/dots,
|
||||
# and % symbols. Invalid options will raise an exception
|
||||
def valid_option(option)
|
||||
raise StandardError, "CodeSandbox Error: Invalid options" unless (option =~ /\A(initialpath=([a-zA-Z0-9\-\_\/\.\@\%])+)\Z|\A(module=([a-zA-Z0-9\-\_\/\.\@\%])+)\Z|\A(runonclick=((0|1){1}))\Z|\Aview=(editor|split|preview)\Z/)&.zero?
|
||||
raise StandardError, "CodeSandbox Error: Invalid options" unless (option =~ OPTIONS_REGEXP)&.zero?
|
||||
|
||||
option
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue