Sha256: 81739fac36ed155644f997ccc713af87b1f2dc60f614c514af5185cf9864927c

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# -*- coding: UTF-8 -*-
#
# Copyright 2014 PagerDuty, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module LitaGithub
  # Github handler common-use regex constants
  #
  # @author Tim Heckman <tim@pagerduty.com>
  module R
    # command alias regex (!gh or !github for example)
    A_REG     ||= '(?:gh|github)\s+?'

    # option regex, letting you scan the string for things like:
    #  key1:value key2:"value2" key3:'a better value'
    OPT_REGEX ||= /((?:\s+?[a-zA-Z0-9_]+?):(?:(?:".+?")|(?:'.+?')|(?:[a-zA-Z0-9_\-]+)))/

    # regex matcher for a repo name (not including the org).
    REPO_NAME_REGEX = '(?<repo_name>[a-zA-Z0-9_\-]+)'

    # regex matcher for: Org/repo
    REPO_REGEX = '(?:(?<org>[a-zA-Z0-9_\-]+)(?:\s+?)?\/)?(?:\s+?)?(?<repo>[a-zA-Z0-9_\-]+)'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lita-github-0.3.0 lib/lita-github/r.rb
lita-github-0.2.2 lib/lita-github/r.rb