Module: ActsAsWordCloud::WordCloud::ClassMethods
- Defined in:
- lib/acts_as_word_cloud/word_cloud.rb
Instance Method Summary collapse
-
#acts_as_word_cloud(args = {}) ⇒ Object
Sets up the word_cloud method and takes arguments that control what it returns.
Instance Method Details
#acts_as_word_cloud(args = {}) ⇒ Object
Sets up the word_cloud method and takes arguments that control what it returns
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/acts_as_word_cloud/word_cloud.rb', line 16 def acts_as_word_cloud(args = {}) # getter/setter methods for the module mattr_accessor :word_cloud_attributes unless respond_to? :word_cloud_attributes = [:included_methods, :excluded_methods, :excluded_models, :depth, :object_name_methods] # set defaults args[:included_methods] ||= [] args[:excluded_methods] ||= [] args[:excluded_models] ||= [] args[:excluded_models] |= ::ActsAsWordCloud.config.permanently_excluded_models args[:depth] ||= ::ActsAsWordCloud.config.default_search_depth # note that the user passes in object_name_method and it is turned into the array object_name_methods args[:object_name_methods] = args[:object_name_method] ? [args[:object_name_method]] : ::ActsAsWordCloud.config.object_name_methods self.word_cloud_attributes = args.keep_if { |key| .include?(key) } include ActsAsWordCloud::WordCloud::InstanceMethods end |