module Immature

Constants

PHRASES

An array of phrases to be used in {Immature.make_fun_of}.

You may replace or add to this list at will. Be creative.

VERSION

The currently loaded version of Immature.

Public Class Methods

make_fun_of(sentence) click to toggle source

Make a given sentence more immature (in your pants).

The phrase used will be chosen at random from {Immature::PHRASES}.

@example

Immature.make_fun_of("Show me an example.") #=> "Show me an example in your pants."

@param sentence [#to_s] A normal sentence or paragraph

@return A more immature version of your sentence.

# File lib/immature.rb, line 18
def make_fun_of sentence
  immature_phrase = Immature::PHRASES.sample
  sentence = Treat::Entities::Sentence.new(sentence.to_s).tokenize
  children = sentence.children
  last_word_index = children.rindex { |entity| entity.type == :word }
  children.insert(last_word_index + 1, Treat::Entities::Word.new(immature_phrase))
  sentence.to_s
end