acts_as_word_cloud 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.0.3
2
+
3
+ * Added an option for permanently excluded models to the config file
4
+
1
5
  == 0.0.2
2
6
 
3
7
  * Major code refactoring
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "acts_as_word_cloud"
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremiah Hemphill", "Alfredo Uribe"]
@@ -19,6 +19,8 @@ module ActsAsWordCloud
19
19
  config_accessor :default_search_depth
20
20
  # List of name methods to try on associations
21
21
  config_accessor :object_name_methods
22
+ # Models that should never be included in the word cloud
23
+ config_accessor :permanently_excluded_models
22
24
 
23
25
  def param_name
24
26
  config.param_name.respond_to?(:call) ? config.param_name.call() : config.param_name
@@ -30,6 +32,7 @@ module ActsAsWordCloud
30
32
  configure do |config|
31
33
  config.default_search_depth = 1
32
34
  config.object_name_methods = [:name, :title, :label, :to_s]
35
+ config.permanently_excluded_models = []
33
36
  end
34
37
  end
35
38
 
@@ -22,7 +22,10 @@ module ActsAsWordCloud
22
22
  # set defaults
23
23
  args[:included_methods] ||= []
24
24
  args[:excluded_methods] ||= []
25
+
25
26
  args[:excluded_models] ||= []
27
+ args[:excluded_models] |= ::ActsAsWordCloud.config.permanently_excluded_models
28
+
26
29
  args[:depth] ||= ::ActsAsWordCloud.config.default_search_depth
27
30
  # note that the user passes in object_name_method and it is turned into the array object_name_methods
28
31
  args[:object_name_methods] = args[:object_name_method] ? [args[:object_name_method]] : ::ActsAsWordCloud.config.object_name_methods
@@ -9,4 +9,11 @@ ActsAsWordCloud.configure do |config|
9
9
  # It calls the methods in order meaning it will look for name first.
10
10
  # Make sure that the final method in this list is on every model
11
11
  # config.default_object_names = [:name, :title, :label, :to_s]
12
+
13
+ # A list of models that should never be included on the word cloud
14
+ # Examples include user models, auditing or versioning models, and logging models.
15
+ #
16
+ # Each of the contants in this list will be added to the word cloud attribute, excluded_models.
17
+ # This will happen even when the attribute is included in the mixin call.
18
+ # config.premanently_excluded_models = []
12
19
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: acts_as_word_cloud
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeremiah Hemphill
@@ -186,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - ">="
188
188
  - !ruby/object:Gem::Version
189
- hash: 2660284366431254682
189
+ hash: 39024837777467519
190
190
  segments:
191
191
  - 0
192
192
  version: "0"