Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions lovespell.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
class Lovespell
def initialize(*potions)
@potions = potions
end

def crush
puts "To initiate a crush, procure #{@potions.map(&:capitalize).join(", ")} and slip these items into their breakfast."
end

def infatuation
puts "To initiate an infatuation, slip #{@potions.map(&:upcase).join(", ")} in their coffee."
end

def killspell
puts "To break the spell, dribble #{@potions.map(&:reverse).join(", ")} on their pillow."
end
class Underherspell
def initialize(*potions)
@potions = potions
end

def crush
puts !![@potions].inject(){|rosepetal| rosepetal = !rosepetal} ? "she loves me" : "she loves me not"
end

def infatuation
@potions.each{|anything| puts "I would give all the #{anything} in the world to be with her"}
end

def killspell
puts "#{"she remains faintly present, ever in my heart".reverse} #{@potions.map(&:reverse).join(", ")} #{"And yet, like the lingering scent of".reverse}"
end
end

cutemathematician= Lovespell.new("honey", "saffron", "chocolate")
cutemathematician= Underherspell.new("honey", "saffron", "chocolate")
cutemathematician.crush
cutemathematician.infatuation
cutemathematician.killspell

puts "\n" * 3

girlwithtattoo = Lovespell.new( "agave nectar", "yogurt", "roasted almonds", "vanilla", "hazelnuts")
girlwithtattoo.crush
girlwithtattoo.infatuation
girlwithtattoo.killspell

puts "#{"\n<3"*3}\n\n"

puts "\n" * 3
programmerwithmotorcycle = Underherspell.new( "agave nectar", "yogurt", "roasted almonds", "vanilla", "hazelnuts")
programmerwithmotorcycle.crush
programmerwithmotorcycle.infatuation
programmerwithmotorcycle.killspell