lib/yt/url.rb
def find_pattern_match
      patterns.find(-> {{kind: :unknown}}) do |kind, regex|
        if data = @text.match(regex)
          # Note: With Ruby 2.4, the following is data.named_captures
          break data.names.zip(data.captures).to_h.merge kind: kind
        end
      end
    end
def find_pattern_match
      patterns.find(-> {{kind: :unknown}}) do |kind, regex|
        if data = @text.match(regex)
          # Note: With Ruby 2.4, the following is data.named_captures
          break data.names.zip(data.captures).to_h.merge kind: kind
        end
      end
    end
def find_pattern_match patterns . find ( -> { { kind : :unknown } } ) do | kind , regex | if data = @text . match ( regex ) # Note: With Ruby 2.4, the following is data.named_captures break data . names . zip ( data . captures ) . to_h . merge kind : kind end end end
PATTERN MATCHING
PATTERN MATCHING