Sha256: 1adf3aaab8b6ebe23d8b8da93628e1662ae1af71b22c2d1ec1c24ff027247310

Contents?: true

Size: 480 Bytes

Versions: 4

Compression:

Stored size: 480 Bytes

Contents

class Symbol
  # Generates a new symbol that is unique among the 
  # method names of a given class or object. If no
  # parameter is given then Object class is assumed.
  #
  #   require 'facet/symbol/gen'
  #
  #   :class.gen => :clast
  #
  def gen( obj=nil )
    s = self.to_s
    if Class === obj
      while klass.method_defined?( s )
        s = s.succ
      end
    else
      while obj.respond_to?( s )
        s = s.succ
      end
    end
    return s.to_sym
  end
end 

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet/symbol/gen.rb
facets-0.7.0 lib/facet/symbol/gen.rb
facets-0.7.1 lib/facet/symbol/gen.rb
facets-0.7.2 lib/facet/symbol/gen.rb