Class: CurationConcerns::QuickClassificationQuery
- Inherits:
-
Object
- Object
- CurationConcerns::QuickClassificationQuery
- Defined in:
- app/models/curation_concerns/quick_classification_query.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#all? ⇒ Boolean
True if the requested concerns is same as all avaliable concerns.
-
#authorized_models ⇒ Array
A list of all the requested concerns that the user can create.
- #each(&block) ⇒ Object
-
#initialize(user, options = {}) ⇒ QuickClassificationQuery
constructor
A new instance of QuickClassificationQuery.
Constructor Details
#initialize(user, options = {}) ⇒ QuickClassificationQuery
Returns a new instance of QuickClassificationQuery.
9 10 11 12 13 |
# File 'app/models/curation_concerns/quick_classification_query.rb', line 9 def initialize(user, = {}) @user = user @concern_name_normalizer = .fetch(:concern_name_normalizer, ClassifyConcern.method(:to_class)) @models = .fetch(:models, CurationConcerns.config.registered_curation_concern_types) end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'app/models/curation_concerns/quick_classification_query.rb', line 3 def user @user end |
Instance Method Details
#all? ⇒ Boolean
Returns true if the requested concerns is same as all avaliable concerns.
20 21 22 |
# File 'app/models/curation_concerns/quick_classification_query.rb', line 20 def all? models == CurationConcerns.config.registered_curation_concern_types end |
#authorized_models ⇒ Array
Returns a list of all the requested concerns that the user can create.
25 26 27 |
# File 'app/models/curation_concerns/quick_classification_query.rb', line 25 def normalized_model_names.select { |klass| user.can?(:create, klass) } end |
#each(&block) ⇒ Object
15 16 17 |
# File 'app/models/curation_concerns/quick_classification_query.rb', line 15 def each(&block) .each(&block) end |