Sha256: ab2e55bd3ac5056fc6d219a11a20ea9e2788beccbf874b1f87f6ade660ecdede

Contents?: true

Size: 823 Bytes

Versions: 8

Compression:

Stored size: 823 Bytes

Contents

class CharacterSet
  module CoreExt
    module StringExt
      def character_set
        CharacterSet.of(self)
      end

      {
        covered_by_character_set?: :cover?,
        delete_character_set:      :delete_in,
        delete_character_set!:     :delete_in!,
        keep_character_set:        :keep_in,
        keep_character_set!:       :keep_in!,
        uses_character_set?:       :used_by?,
      }.each do |string_method, set_method|
        class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def #{string_method}(arg)
            if arg.instance_of?(Symbol)
              CharacterSet.__send__(arg).#{set_method}(self)
            else
              arg.#{set_method}(self)
            end
          end
        RUBY
      end
    end
  end
end

::String.send(:include, CharacterSet::CoreExt::StringExt)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
character_set-1.2.0-java lib/character_set/core_ext/string_ext.rb
character_set-1.2.0 lib/character_set/core_ext/string_ext.rb
character_set-1.1.2-java lib/character_set/core_ext/string_ext.rb
character_set-1.1.2 lib/character_set/core_ext/string_ext.rb
character_set-1.1.1-java lib/character_set/core_ext/string_ext.rb
character_set-1.1.1 lib/character_set/core_ext/string_ext.rb
character_set-1.1.0-java lib/character_set/core_ext/string_ext.rb
character_set-1.1.0 lib/character_set/core_ext/string_ext.rb