abstractor 1.0.13 → 1.0.14

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODE2ODcyZDAyMTdjM2I5ODg3ZjExMTZkMTVkM2QwMGUzNzZiNmFiYg==
4
+ YWYyNzk5NjkxOTcyZjMyZjg2MDM0OWQ0MzgwZWVhZTZkMGFhMzY4OA==
5
5
  data.tar.gz: !binary |-
6
- YTU1NzA5OGM3MTI5MjUyYThiNTc0MDAyYjU4MGViZmU3MTkyMTliNA==
6
+ ZWYxNTJlNjA1NDYzYjJkMDdjOTYzMDk5NjMyMjM5NTRhOTYyNmQ3ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWRkMGRjZTRkMWZhZDYyMzUyYWEwYjJlZDhiYThhYTA1MmVlNjZjMDFiMjYz
10
- MDFmNTQ1OWFlZGQ3Mzg3NWM3YzQ2ZjViMWI4NzU1OTdmYTk4ZjBmNWIwMmUw
11
- YjFmZjQ3YTZjYzI3OGM3MmQ0YWE0YmUwMDIxMDAzN2M5ZGMxMzY=
9
+ MTNhZDQ1Mzg0MzRiYTI4Nzc4ODE3ZTFiMmMzZWRhNzE3NjlmNzA2NTQ1MjAy
10
+ YzhlMTJhN2IxMWFlODA5YjdjMjliOWEwYTI2Y2ZiZGFkNGRhZGYxNzliODBk
11
+ M2U1ZTk4MjE4Zjk0ZmU4MGY1MmZlMjhlZWE2YzQxODhmNDY0ZDM=
12
12
  data.tar.gz: !binary |-
13
- MWI3N2ZhMDdlOWYzM2JmNWE2YmYxYTNlMDZjNDkzZTBkZGI1OTQ0NzdkNzM4
14
- NzZhZTdmMjM4ZWRiZTJlYWU2OWE3OTUzNTZjNjFlZjQ2OGIzMjQwNDk3ZjRl
15
- OTdjNmJkNWIzYWQxMTNlNzhiYWIwMjQxMzNmNzFhNGFjMjZmZWI=
13
+ OTI1ZTUyZGQ3YzAxZDVjNDUxNjdhOGZmY2MyOTE0Y2NjNzJlYzlkOGJiZWJj
14
+ MTc4MTE1ZTU3MmEyY2UzNzk1YjQ4ODAzMmIzNDYzZDQ3ODhhZDljYzNjZTlh
15
+ ZmQ3MGEzMmI0ZDk5ZTg3ODZmNmI1NzFiODQwZjUzOTlkMjgwZTc=
@@ -35,15 +35,15 @@
35
35
  = abstractor_suggestion.display_value
36
36
  - if abstractor_suggestion.abstractor_suggestion_sources.any?
37
37
  - abstractor_suggestion.abstractor_suggestion_sources.each do |abstractor_suggestion_source|
38
- - from_method = abstractor_suggestion_source.abstractor_abstraction_source.from_method
38
+ - from_method = abstractor_suggestion_source.source_method
39
39
  - if about.respond_to?(from_method)
40
40
  %span{ :class => 'abstractor_abstraction_source_tooltip_img label', :rel => "#abstraction_text_#{abstractor_suggestion_source.id}", :title => "#{about.class.to_s} #{from_method}"}
41
41
  = image_tag('abstractor/page.png', :id => "abstraction_text_link_#{abstractor_suggestion_source.id}")
42
42
  %div{ :id => "abstraction_text_#{abstractor_suggestion_source.id}", :class => 'abstractor_abstraction_source_tooltip'}
43
43
  - abstractable_from_column = about.send(from_method)
44
44
  - unless abstractable_from_column.nil?
45
- - if abstractor_suggestion_source.match_value
46
- = Abstractor::UserInterface.highlight(simple_format(abstractable_from_column.clone), abstractor_suggestion_source.match_value.strip)
45
+ - if abstractor_suggestion_source.sentence_match_value
46
+ = Abstractor::UserInterface.highlight(simple_format(abstractable_from_column.clone), abstractor_suggestion_source.sentence_match_value.strip)
47
47
  - else
48
48
  = simple_format(abstractable_from_column.clone)
49
49
  .column-3
@@ -51,14 +51,16 @@ module Abstractor
51
51
  abstractor_abstractions.map(&:abstractor_suggestions).flatten.select { |as| Array.new(abstractor_suggestion_statuses).any? { |abstractor_suggestion_status| as.abstractor_suggestion_status == abstractor_suggestion_status } }
52
52
  end
53
53
 
54
- def remove_abstractions
54
+ def remove_abstractions(only_unreviewed = true)
55
55
  abstractor_abstractions.each do |abstractor_abstraction|
56
- abstractor_abstraction.abstractor_suggestions.each do |abstractor_suggestion|
57
- abstractor_suggestion.abstractor_suggestion_sources.destroy_all
58
- abstractor_suggestion.abstractor_suggestion_object_value.destroy
59
- abstractor_suggestion.destroy
56
+ if !only_unreviewed || (only_unreviewed && abstractor_abstraction.unreviewed?)
57
+ abstractor_abstraction.abstractor_suggestions.each do |abstractor_suggestion|
58
+ abstractor_suggestion.abstractor_suggestion_sources.destroy_all
59
+ abstractor_suggestion.abstractor_suggestion_object_value.destroy
60
+ abstractor_suggestion.destroy
61
+ end
62
+ abstractor_abstraction.destroy
60
63
  end
61
- abstractor_abstraction.destroy
62
64
  end
63
65
  end
64
66
  end
@@ -80,15 +82,14 @@ module Abstractor
80
82
  end
81
83
 
82
84
  ##
83
- # Reports the abstractor subjects associated with the abstractable entity.
85
+ # Returns the abstractor subjects associated with the abstractable entity.
86
+ #
84
87
  # By default, the method will return all abstractor subjects.
85
- # The :grouped option allows the filtration to grouped or non-grouped
86
- # abstractor subjects.
87
- # grouped: true filters to only grouped abstractor subjects.
88
- # grouped: false filters to only nont-grouped abstractor subjects.
89
88
  #
90
- # @param [Hash] options to filter the the list of abstractor subjects
89
+ # @param [Hash] options the options to filter the objects returned
90
+ # @option options [Boolean] :grouped Filters the list of Abstactor::AbstractorSubject objects to grouped and non-grouped. Defaults to nil which returns all objects.
91
91
  # @return ActiveRecord::Relation list of Abstactor::AbstractorSubject objects
92
+
92
93
  def abstractor_subjects(options = {})
93
94
  options = { grouped: nil }.merge(options)
94
95
  subjects = Abstractor::AbstractorSubject.where(subject_type: self.to_s)
@@ -104,14 +105,12 @@ module Abstractor
104
105
  end
105
106
 
106
107
  ##
107
- # Reports the abstractor abstraction schemas associated with the abstractable entity.
108
+ # Returns the abstractor abstraction schemas associated with the abstractable entity.
109
+ #
108
110
  # By default, the method will return all abstractor abstraction schemas.
109
- # the :grouped options allows the filtration to grouped or non-grouped
110
- # abstractor abstraction schemas.
111
- # grouped: true filters to only grouped abstractor abstraction schemas.
112
- # grouped: false filters to only nont-grouped abstractor abstraction schemas.
113
111
  #
114
- # @param [Hash] options to filter the the list of abstractor abstractions schemas
112
+ # @param [Hash] options the options to filter the objects returned
113
+ # @option options [Boolean] :grouped Filters the list of Abstractor::AbstractorAbstractionSchema objects to grouped and non-grouped. Defaults to nil which returns all objects.
115
114
  # @return ActiveRecord::Relation list of Abstactor::AbstractorAbstractionSchema objects
116
115
  def abstractor_abstraction_schemas(options= {})
117
116
  options = { grouped: nil }.merge(options)
@@ -59,6 +59,11 @@ module Abstractor
59
59
  abstractor_suggestion.suggested_value == suggested_value
60
60
  end
61
61
  end
62
+
63
+ def unreviewed?
64
+ abstractor_suggestion_status_needs_review = Abstractor::AbstractorSuggestionStatus.where(name: 'Needs review').first
65
+ abstractor_suggestions.any? { |abstractor_suggestion| abstractor_suggestion.abstractor_suggestion_status == abstractor_suggestion_status_needs_review }
66
+ end
62
67
  end
63
68
  end
64
69
  end
@@ -1,3 +1,3 @@
1
1
  module Abstractor
2
- VERSION = '1.0.13'
2
+ VERSION = '1.0.14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gurley, Yulia Bushmanova
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails