Module: WithSlug

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

Overview

TODO may use mumukit slug

Instance Method Summary collapse

Instance Method Details

#normalize_slug!Object



20
21
22
# File 'app/models/concerns/with_slug.rb', line 20

def normalize_slug!
  self.slug = self.slug.to_mumukit_slug.normalize.to_s
end

#rebase!(organization) ⇒ Object

Copy and Rebase



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

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

#rebased_dup(organization) ⇒ Object



30
31
32
# File 'app/models/concerns/with_slug.rb', line 30

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

#transparent_idObject



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

def transparent_id
  slug
end

#transparent_paramsObject



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

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