Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class ParagraphVisitor
  2. def visit(paragraph_node)
  3. "<p>#{sentences_for(paragraph_node)}</p>"
  4. end
  5.  
  6. private
  7.  
  8. def sentences_for(paragraph_node)
  9. paragraph_node.sentences.map do |sentences|
  10. sentence_visitor.visit(sentences)
  11. end.join
  12. end
  13.  
  14. def sentence_visitor
  15. @sentence_visitor ||= SentenceVisitor.new
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement