Class: Helpers::HashtagHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/hashtag_helper.rb

Class Method Summary collapse

Class Method Details

.make_hashtag(array) ⇒ Object

Raises:



7
8
9
10
11
12
13
14
# File 'lib/helpers/hashtag_helper.rb', line 7

def self.make_hashtag(array)
  raise Errors::DataError, 'Hashtag should consist of one or more symbols' if array.empty?

  hashtag = "##{array.map(&:to_s).map(&:capitalize).join}"
  raise Errors::DataError, 'Hashtag max length 140 symbols' if hashtag.length > 140

  hashtag
end