Sha256: 65f0819f28e6064f630d090eaa2636fe724843a28d2f8637da8616a1a96bf458

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

module Cape

  module CoreExt

    # Contains extensions to the Symbol core class.
    module Symbol

      # Returns +0+ if the Symbol is equal to _other_, +-1+ if it is
      # alphabetically lesser than _other_, and +1+ if it is alphabetically
      # greater than _other_.
      def <=>(other)
        to_s <=> other.to_s
      end

    end

  end

end

unless Symbol.instance_methods.collect(&:to_s).include?('<=>')
  Symbol.class_eval do
    include Cape::CoreExt::Symbol
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cape-1.0.1 lib/cape/core_ext/symbol.rb
cape-1.0.0 lib/cape/core_ext/symbol.rb