Sha256: 739c178ec086ee26a1bddccc705d091f77722816e90ffe1755154d0e63c22711
Contents?: true
Size: 412 Bytes
Versions: 1
Compression:
Stored size: 412 Bytes
Contents
if not String.method_defined? :to_underscore class String # ruby mutation methods have the expectation to return self if a mutation # occurred, nil otherwise. # (see http://www.ruby-doc.org/core-1.9.3/String.html#method-i-gsub-21) def to_underscore! gsub!(/(.)([A-Z])/,'\1_\2') && downcase! end def to_underscore dup.tap { |s| s.to_underscore! } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arnold-0.0.1 | lib/arnold/monkeypatch.rb |