Module: WithSlug

Extended by:
ActiveSupport::Concern
Included in:
Content
Defined in:
app/models/concerns/with_slug.rb

Overview

TODO may use mumukit slug

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#rebase!(organization) ⇒ Object

Copy and Rebase



23
24
25
# File 'app/models/concerns/with_slug.rb', line 23

def rebase!(organization)
  self.slug = self.slug.to_mumukit_slug.rebase(organization).to_s
end

#rebased_dup(organization) ⇒ Object



27
28
29
# File 'app/models/concerns/with_slug.rb', line 27

def rebased_dup(organization)
  dup.tap { |it| it.rebase! organization }
end

#slug_partsObject



10
11
12
13
# File 'app/models/concerns/with_slug.rb', line 10

def slug_parts
  org, repo = slug.split('/')
  {organization: org, repository: repo}
end

#sync_keyObject

Resource Protocol



17
18
19
# File 'app/models/concerns/with_slug.rb', line 17

def sync_key
  Mumukit::Sync.key self.class.name.underscore.to_sym, slug
end