<commit_before>#
# Rubygames Named Resources for GOSU
# Assumes a global variable $window having the Gosu::Window instance.
# Quick 'n easy access to sprites, sounds and tiles!
#
module Chingu
  def media_path(file)
    File.join(ROOT, "media", file)  
  end

  def root_path(file)
    File.join(ROOT, file)  
  end

  def image_path(file)
    File.join(ROOT, "images", file)
  end
  
  class Asset
    include Chingu::NamedResource
		
    def self.autoload(name)
      find_file(name)
    end
  end
end

#
# Extend GOSU's core classes with NamedResource
#
module Gosu
  class Image
    include Chingu::NamedResource
    
    def self.autoload(name)
      (path = find_file(name)) ? Gosu::Image.new($window, path, true) : nil
    end
  end

  class Song
    include Chingu::NamedResource
		
    def self.autoload(name)
      (path = find_file(name)) ? Gosu::Song.new($window, path) : nil
    end<commit_msg>Image[]-asset-shortcut now raises error if image doesn't exist<commit_after>#
# Rubygames Named Resources for GOSU
# Assumes a global variable $window having the Gosu::Window instance.
# Quick 'n easy access to sprites, sounds and tiles!
#
module Chingu
  def media_path(file)
    File.join(ROOT, "media", file)  
  end

  def root_path(file)
    File.join(ROOT, file)  
  end

  def image_path(file)
    File.join(ROOT, "images", file)
  end
  
  class Asset
    include Chingu::NamedResource
		
    def self.autoload(name)
      find_file(name)
    end
  end
end

#
# Extend GOSU's core classes with NamedResource
#
module Gosu
  class Image
    include Chingu::NamedResource
    
    def self.autoload(name)
      ret = (path = find_file(name)) ? Gosu::Image.new($window, path, true) : nil
      raise "Can't load image \"#{name}\"" if ret.nil?
      return ret
    end
  end

  class Song
    include Chingu::NamedResource
		
    def self.autoload(name)
      (path = find_file(name)) ? Gosu::Song.new($window, path) : nil
    end
{'fraction_non_alphanumeric': 0.10097887686759402, 'fraction_numerical': 0.0, 'mean_word_length': 3.114406779661017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6303159', 'n_tokens_mistral': 687, 'n_tokens_neox': 655, 'n_words': 190}