Module: ActsAsWordCloud::WordCloud::InstanceMethods

Defined in:
lib/acts_as_word_cloud/word_cloud.rb

Instance Method Summary collapse

Instance Method Details

#word_cloud(return_type = :string) ⇒ Array<String> or String

Uses recursive word cloud to find text attributes, associations and included methods on the model

Parameters:

  • return_type (Symbol) (defaults to: :string)

    Whether to return an array or string, defaulting to :string

Returns:

  • (Array<String> or String)

    All processed values



44
45
46
47
48
49
50
51
# File 'lib/acts_as_word_cloud/word_cloud.rb', line 44

def word_cloud(return_type = :string)
  output = recursive_word_cloud(self.word_cloud_attributes[:depth]).uniq.flatten
  if return_type == :string
    return output.join(' ')
  else
    return output
  end
end