Skip to content

Instantly share code, notes, and snippets.

@craigmcnamara
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigmcnamara/a4f28434a3d4aa950c18 to your computer and use it in GitHub Desktop.
Save craigmcnamara/a4f28434a3d4aa950c18 to your computer and use it in GitHub Desktop.
JRuby Regex Strangeness

Setup

Given this method calling to Compass::SpriteImporter.path_and_name and patched to raise an exception

Compass::SassExtensions::Sprites::SpriteMap.class_eval do
  def self.from_uri(uri, context, kwargs)
    uri = uri.value
    path, name = Compass::SpriteImporter.path_and_name(uri)
    raise "Path: #{path} Name: #{name} URI: #{uri} CallReturn: #{Compass::SpriteImporter.path_and_name(uri)}"
    files = Compass::SpriteImporter.files(uri)
    sprites = files.map do |sprite|
      relative_name(sprite)
    end
    new(sprites, path, name, context, kwargs)
  end
end

Results

JRuby Head

Path: Name: URI: letters/*.png CallReturn: [nil, nil]

Mri 2.1.5

Path: letters Name: letters URI: letters/*.png CallReturn: ["letters", "letters"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment