Skip to content

bug(ruby) 'if defined?' is mis-highlighted as a def method #3025

@Lupraxus

Description

@Lupraxus

When highlighting ruby code the matching is not correctly matching on 'if defined'

for example:

if defined?(key)

Instead of matching on the 2 keywords IF and DEFINED it instead matches on IF and DEF as keywords then matched INED as a title. The downside to this is the word defined is now in 2 different colours.

I think it is related to the use if def when defining a function in ruby and so it is matching def from the word defined and thinks you have a function called ined.

I am using version 10.5.0 of highlight.

Sample Code:

I am using sunburst.css (although this happens in others and I don't think the css is the issue)

#!/usr/bin/env ruby

require 'rubygems'
require 'gems'
require 'terminal-table'

if defined?(key)
    Gems.configure do |config|
        config.key = key
    end
else
    puts 'Using default gem creds'
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions