Sha256: e40d7cb2139a2ecec5e340c0cdaa3b6cfcdbdaf267e4e5cc4c80f286d0cbe2e2

Contents?: true

Size: 442 Bytes

Versions: 10

Compression:

Stored size: 442 Bytes

Contents

class Symbol

  unless method_defined?(:succ)  # 1.9+ TODO: is this right?

    # Successor method for symobol. This simply converts
    # the symbol to a string uses String#succ and then
    # converts it back to a symbol.
    #
    #   :a.succ  #=> :b
    #
    # TODO: Make this work more like a simple character dial?

    def succ(n=1)
      s = self.to_s
      n.times do
        s = s.succ
      end
      s.to_sym
    end

  end

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/symbol/succ.rb
facets-3.1.0 lib/core/facets/symbol/succ.rb
facets-3.0.0 lib/core/facets/symbol/succ.rb
facets-2.9.3 lib/core/facets/symbol/succ.rb
facets-2.9.2 src/core/facets/symbol/succ.rb
facets-2.9.2 lib/core/facets/symbol/succ.rb
facets-2.9.1 lib/core/facets/symbol/succ.rb
facets-2.9.0 lib/core/facets/symbol/succ.rb
facets-2.9.0.pre.2 lib/core/facets/symbol/succ.rb
facets-2.9.0.pre.1 lib/core/facets/symbol/succ.rb