Skip to content

Instantly share code, notes, and snippets.

@leh
Created December 15, 2011 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leh/1481281 to your computer and use it in GitHub Desktop.
Save leh/1481281 to your computer and use it in GitHub Desktop.
Hyphenate in Ruby
require 'minitest/autorun'
require 'text/hyphen'
describe Text::Hyphen do
let(:described_class) do
Text::Hyphen
end
it "should hyphenate vierschanzentourne correctly" do
hh = described_class.new(:language => 'de', :left => 2, :right => 2)
hh.visualize("Vierschantzentourne").must_equal "Vier-schant-zen-tourne"
end
it "should give the correct points to hyphenate vierschanzentourne" do
hh = described_class.new(:language => 'de', :left => 2, :right => 2)
hh.hyphenate("Vierschantzentourne").must_equal [4,10,13]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment