Sha256: 3420b0a38a553d749bc1fba18b1ff64938530358ccd29c98e47ba9a557f40b6b

Contents?: true

Size: 601 Bytes

Versions: 8

Compression:

Stored size: 601 Bytes

Contents

module Cape

  module CoreExt

    # Adds methods missing from Ruby's Symbol core class.
    module Symbol

      # Compares the String representation of the Symbol to that of another.
      #
      # @param [Symbol] other
      # @return  [0] the Symbol is equal to _other_
      # @return [-1] the Symbol is lesser than _other_
      # @return  [1] the Symbol is 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

8 entries across 8 versions & 1 rubygems

Version Path
cape-1.6.0 lib/cape/core_ext/symbol.rb
cape-1.5.0 lib/cape/core_ext/symbol.rb
cape-1.4.0 lib/cape/core_ext/symbol.rb
cape-1.3.0 lib/cape/core_ext/symbol.rb
cape-1.2.0 lib/cape/core_ext/symbol.rb
cape-1.1.0 lib/cape/core_ext/symbol.rb
cape-1.0.3 lib/cape/core_ext/symbol.rb
cape-1.0.2 lib/cape/core_ext/symbol.rb