Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Parsething
- attr_reader :people
- def initialize(doc)
- @doc = doc
- end
- def parse
- @people = @doc[/ABSENT:\n+(.*)-{10}/m, 1].split(/\n+/)
- end
- end
- if $0 == __FILE__
- require "test/unit"
- class ParsethingTest < Test::Unit::TestCase
- def test_it
- @doc = "foo\n\nbar\n\nbaz\nABSENT:\n\nSomeone\nOther person\n\n\n\nSomeone else\n----------\n\nFoo"
- @parsething = Parsething.new(@doc)
- @parsething.parse
- assert_equal ["Someone", "Other person", "Someone else"], @parsething.people
- end
- end
- end
Add Comment
Please, Sign In to add comment