Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/noah/applications.rb | 46 | 39 | 73.91%
|
69.23%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 class Application < Ohm::Model |
2 include Ohm::Typecast |
3 include Ohm::Timestamping |
4 include Ohm::Callbacks |
5 include Ohm::ExtraValidations |
6 |
7 attribute :name |
8 collection :configurations, Configuration |
9 |
10 index :name |
11 |
12 def validate |
13 assert_present :name |
14 assert_unique :name |
15 end |
16 |
17 def to_hash |
18 arr = [] |
19 configurations.sort.each {|c| arr << c.to_hash} |
20 super.merge(:name => name, :updated_at => updated_at, :configurations => arr) |
21 end |
22 |
23 def is_new? |
24 self.created_at == self.updated_at |
25 end |
26 |
27 class << self |
28 def find_or_create(opts = {}) |
29 begin |
30 find(opts).first.nil? ? (app = create(opts)) : (app = find(opts).first) |
31 if app.valid? |
32 app.save |
33 end |
34 app |
35 rescue Exception => e |
36 e.message |
37 end |
38 end |
39 end |
40 end |
41 |
42 class Applications |
43 def self.all(options = {}) |
44 options.empty? ? Application.all.sort : Application.find(options).sort |
45 end |
46 end |
Generated on 2011-02-08 01:54:20 -0500 with rcov 0.9.8