Module: CanvasSync::Record
- Extended by:
- ActiveSupport::Concern
- Includes:
- Concerns::SyncMapping
- Included in:
- Account, Admin, Assignment, AssignmentGroup, Concerns::Account::Ancestry, ContentMigration, ContextModule, ContextModuleItem, Course, CourseNickname, Enrollment, GradingPeriod, GradingPeriodGroup, Group, GroupMembership, LearningOutcome, LearningOutcomeResult, Pseudonym, Role, Rubric, RubricAssessment, RubricAssociation, Section, Submission, Term, User, UserObserver
- Defined in:
- lib/canvas_sync/record.rb
Class Method Summary collapse
- ._get_module_parent(modul) ⇒ Object
- .define_feature(modul, feature_ident = nil, models: nil, default: false, &blk) ⇒ Object
- .registered_features ⇒ Object
Methods included from Concerns::SyncMapping
Class Method Details
._get_module_parent(modul) ⇒ Object
30 31 32 |
# File 'lib/canvas_sync/record.rb', line 30 def self._get_module_parent(modul) modul.respond_to?(:parent) ? modul.parent : modul.module_parent end |
.define_feature(modul, feature_ident = nil, models: nil, default: false, &blk) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/canvas_sync/record.rb', line 13 def self.define_feature(modul, feature_ident = nil, models: nil, default: false, &blk) feature_ident = modul.name.demodulize.underscore if feature_ident.nil? if models == nil pmod = _get_module_parent(modul) models = pmod.name.demodulize if pmod && _get_module_parent(pmod) == CanvasSync::Concerns end @canvas_sync_features ||= {} @canvas_sync_features[feature_ident] = { name: feature_ident, module: modul, default: default, models: Array.wrap(models).map(&:to_s), setup: blk || ->{ include modul }, } end |
.registered_features ⇒ Object
9 10 11 |
# File 'lib/canvas_sync/record.rb', line 9 def self.registered_features @canvas_sync_features ||= {} end |