Module: HasPlaceholderImage::TextGenerator

Defined in:
lib/has_placeholder_image/text_generator.rb

Overview

Text generation methods

Class Method Summary collapse

Class Method Details

.two_word_first_letter_upcase(value) ⇒ Object

This method take text field and parse with delimiter and take first word_count number word first letter upcase



8
9
10
11
12
13
14
15
# File 'lib/has_placeholder_image/text_generator.rb', line 8

def self.two_word_first_letter_upcase(value)
  value.split
       .map(&:first)
       .select { |l| l =~ /[[:alpha:]]/ }
       .join
       .first(2)
       .upcase
end