Class: EasyTags::Generators::Default

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_tags/generators/default.rb

Overview

Default generator for [Array] -> [String] conversion

Class Method Summary collapse

Class Method Details

.generate(tag_list) ⇒ String

Generates a new String using the given Array

Example:

EasyTags::Generators::Default.generate(['One', 'Two', 'Three'])
'One, Two, Three'

14
15
16
17
18
19
20
# File 'lib/easy_tags/generators/default.rb', line 14

def generate(tag_list)
  tag_list ||= []

  return '' if tag_list.empty?

  tag_list.join(',')
end