class PainInTheRspec::Pundit
Constants
- BANNED_WORDS
Attributes
original[R]
Public Class Methods
new(original)
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 7 def initialize(original) @original = original end
Public Instance Methods
pun()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 11 def pun if found_pun? [found_pun.new_phrase, rest_of_phrase].join(" ").strip else "[pun of #{original}]" end end
Private Instance Methods
filtered()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 45 def filtered original.split(" ") - BANNED_WORDS end
found_pun()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 27 def found_pun @found_pun ||= GirlsJustWantToHavePuns.pun(pun_word) || GirlsJustWantToHavePuns.pun(singular_pun_word) || GirlsJustWantToHavePuns.pun(other_singular_pun_word) end
found_pun?()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 23 def found_pun? !found_pun.nil? end
other_singular_pun_word()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 41 def other_singular_pun_word pun_word.sub(/es$/, "") end
pun_word()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 33 def pun_word filtered.first end
rest_of_phrase()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 49 def rest_of_phrase if filtered.size > 0 filtered[1..-1].join(" ") else "" end end
singular_pun_word()
click to toggle source
# File lib/pain_in_the_rspec/pundit.rb, line 37 def singular_pun_word pun_word.sub(/s$/, "") end