Class: Booth::Syntaxes::Scope

Inherits:
Object
  • Object
show all
Includes:
Logging, Calls
Defined in:
lib/booth/syntaxes/scope.rb

Instance Method Summary collapse

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'lib/booth/syntaxes/scope.rb', line 11

def call
  if regexp.match(input.to_s)
    return Tron.success(:valid_scope_syntax, normalized_scope: input.to_sym)
  end

  raise ::Booth::Errors::InvalidScopeSyntax, input
end

#regexpObject

Same convention as a Ruby variable name.



20
21
22
# File 'lib/booth/syntaxes/scope.rb', line 20

def regexp
  /\A[a-z]{1}[a-z0-9_]{0,40}[a-z0-9]{1}\z/
end