Sha256: b56300021388b3f19595c53f13d5d3237a3feb5a73ca8a70d5ad631cc281eede
Contents?: true
Size: 639 Bytes
Versions: 1
Compression:
Stored size: 639 Bytes
Contents
require 'nano/string/to_arr' require 'nano/enumerable/frequency' class String def frequency(*args) to_arr(*args).frequency end end #-- # NOTE: add String#occur and String#occur_within in future ? #++ # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCString < Test::Unit::TestCase def test_frequency assert_equal( {'a'=>1,'b'=>1}, "ab".frequency ) assert_equal( {'tom'=>1,'boy'=>1}, "tom boy".frequency(:word) ) assert_equal( {'tom'=>1,'boy'=>1}, "tom\nboy".frequency(:line) ) end end =end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.9.0 | lib/nano/string/frequency.rb |