class Git::Lint::Parsers::Trailers::Collaborator

Constants

DEFAULT_KEY_PATTERN
DEFAULT_MATCH_PATTERN

Public Class Methods

new(text, key_pattern: DEFAULT_KEY_PATTERN, match_pattern: DEFAULT_MATCH_PATTERN) click to toggle source
# File lib/git/lint/parsers/trailers/collaborator.rb, line 20
def initialize text,
               key_pattern: DEFAULT_KEY_PATTERN,
               match_pattern: DEFAULT_MATCH_PATTERN

  @text = String text
  @key_pattern = key_pattern
  @match_pattern = match_pattern
  @matches = build_matches
end

Public Instance Methods

build_matches() click to toggle source
# File lib/git/lint/parsers/trailers/collaborator.rb, line 42
def build_matches
  text.match(match_pattern).then { |data| data ? data.named_captures : Hash.new }
end
email(= String(matches["email"]).delete_prefix("<").delete_suffix(">")) click to toggle source
# File lib/git/lint/parsers/trailers/collaborator.rb, line 34
    def email = String(matches["email"]).delete_prefix("<").delete_suffix(">")

    def match? = text.match?(key_pattern)

    private

    attr_reader :text, :key_pattern, :match_pattern, :matches

    def build_matches
      text.match(match_pattern).then { |data| data ? data.named_captures : Hash.new }
    end
  end
end
key(= String(matches["key"])) click to toggle source
# File lib/git/lint/parsers/trailers/collaborator.rb, line 30
        def key = String(matches["key"])

        def name = String(matches["name"])

        def email = String(matches["email"]).delete_prefix("<").delete_suffix(">")

        def match? = text.match?(key_pattern)

        private

        attr_reader :text, :key_pattern, :match_pattern, :matches

        def build_matches
          text.match(match_pattern).then { |data| data ? data.named_captures : Hash.new }
        end
      end
    end
  end
end
match?(= text.match?(key_pattern)) click to toggle source
# File lib/git/lint/parsers/trailers/collaborator.rb, line 36
  def match? = text.match?(key_pattern)

  private

  attr_reader :text, :key_pattern, :match_pattern, :matches

  def build_matches
    text.match(match_pattern).then { |data| data ? data.named_captures : Hash.new }
  end
end
name(= String(matches["name"])) click to toggle source
# File lib/git/lint/parsers/trailers/collaborator.rb, line 32
      def name = String(matches["name"])

      def email = String(matches["email"]).delete_prefix("<").delete_suffix(">")

      def match? = text.match?(key_pattern)

      private

      attr_reader :text, :key_pattern, :match_pattern, :matches

      def build_matches
        text.match(match_pattern).then { |data| data ? data.named_captures : Hash.new }
      end
    end
  end
end