Sha256: f6537505b726b3679bab077776d41ee17588ed92b9151690ab906c6483191bfb

Contents?: true

Size: 715 Bytes

Versions: 1

Compression:

Stored size: 715 Bytes

Contents

module Ray
  module SoundSet
    extend Ray::ResourceSet
    
    class << self
      def missing_pattern(string)
        Ray::Sound[string]
      end

      def select!(&block)
        super(&block)
        Ray::Sound.select!(&block)
      end
    end
  end

  # Creates a new sound set.
  #
  # @param [Regexp] regex Regular expression used to match file
  # @yield [*args] Block returning the sound
  #
  # @yieldparam args Regex captures
  def self.sound_set(regex, &block)
    Ray::SoundSet.add_set(regex, &block)
  end
end

begin
  require 'open-uri'

  Ray.sound_set(/^(http|ftp):\/\/(\S+)$/) do |protocol, address|
    open("#{protocol}://#{address}") { |io| Ray::Sound.new(io) }
  end
rescue LoadError
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ray-0.0.1 lib/ray/sound_set.rb