Sha256: 66d3868f5468c65554fbf289de9e8d2bef6e097531863e180ecd12d3de400bc0

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'character_set/ruby_fallback/set_methods'
require 'character_set/ruby_fallback/character_set_methods'

class CharacterSet
  module RubyFallback
    include CharacterSet::RubyFallback::SetMethods
    include CharacterSet::RubyFallback::CharacterSetMethods

    def self.prepended(klass)
      klass.extend CharacterSet::RubyFallback::CharacterSetMethods::ClassMethods
    end

    def initialize(enum = [])
      @__set = CharacterSet::RubyFallback::SortedSet.new
      super
    end
  end
end

if RUBY_PLATFORM[/java/i]
  # JRuby has sorted_set in the stdlib.
  require 'set'
  CharacterSet::RubyFallback::Set       = ::Set
  CharacterSet::RubyFallback::SortedSet = ::SortedSet
else
  # For other rubies, set/sorted_set are vendored due to dependency issues:
  #
  # - issues with default vs. installed gems such as [#2]
  # - issues with the sorted_set dependency rb_tree
  # - long-standing issues in recent versions of sorted_set
  #
  # The RubyFallback, and thus these set classes, are only used for testing,
  # and for exotic rubies which use neither C nor Java.
  require 'character_set/ruby_fallback/vendored_set_classes'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
character_set-1.8.0-java lib/character_set/ruby_fallback.rb
character_set-1.8.0 lib/character_set/ruby_fallback.rb