Sha256: 253e8ac2973677d940d382c976e21cdca7a25155fc201eabb10c82af0456e172
Contents?: true
Size: 769 Bytes
Versions: 4
Compression:
Stored size: 769 Bytes
Contents
require 'active_attr' class ClassifyConcern # @TODO - This should be part of the application configuration # or detected on load VALID_CURATION_CONCERNS = { 'Mock Curation Concern' => 'MockCurationConcern' } include ActiveAttr::Model attribute :curation_concern_type validates( :curation_concern_type, presence: true, inclusion: { in: lambda { |record| VALID_CURATION_CONCERNS.values } } ) def possible_curation_concern_types VALID_CURATION_CONCERNS end def curation_concern_class if possible_curation_concern_types.detect{|name, class_name| class_name == curation_concern_type } curation_concern_type.constantize else raise RuntimeError, "Invalid :curation_concern_type" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
curate-0.1.3 | app/models/classify_concern.rb |
curate-0.1.2 | app/models/classify_concern.rb |
curate-0.1.1 | app/models/classify_concern.rb |
curate-0.1.0 | app/models/classify_concern.rb |