Sha256: 748a696d3ad74c3db7d18da0db76a5fb2b92a6685240b033804f6a79fb9dbdf9

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

module Ray
  module MusicSet
    extend Ray::ResourceSet
    
    class << self
      def missing_pattern(string)
        Ray::Music[string, size]
      end

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

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

begin
  require 'open-uri'

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

Version data entries

1 entries across 1 versions & 1 rubygems

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