Class: MystroVolley::Version

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/mystro_volley/version.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_by_name(name) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/mystro_volley/version.rb', line 22

def find_by_name(name)
  (p, b, v) = name.split(/[\@\:]/)
  #puts "find_by_name: #{p} #{b} #{v}"
  project = MystroVolley::Project.where(name: p).first
  if project
    branch = project.branches.where(name: b).first
    if branch
      version = branch.versions.where(name: v).first
      return version if version
    end
  end
  nil
end

Instance Method Details

#projectObject



13
14
15
# File 'app/models/mystro_volley/version.rb', line 13

def project
  branch ? branch.project : nil
end

#to_sObject



17
18
19
# File 'app/models/mystro_volley/version.rb', line 17

def to_s
  "#{branch.to_s}:#{name}" #" timestamp:#{timestamp} files:#{files ? files.count : 0}"
end