Module: Upworthy

Defined in:
lib/upworthy.rb

Overview

Namespace for constants and methods needed to generate headlines.

Author:

  • William Woodruff

Since:

  • 0.0.1

Class Method Summary collapse

Class Method Details

.headlineString

Generates a new clickbait headline.

Examples:

Upworthy.headline # => "Watch an extroverted police officer become a legend with six words"

Since:

  • 0.0.1


401
402
403
404
405
# File 'lib/upworthy.rb', line 401

def self.headline
	content = Hash[CONTENT.map { |k, v| [k, v.sample] }]

	(HEADLINES.sample % content).gsub('  ', ' ')
end