Class: Emma::Report::Coverage

Inherits:
Object
  • Object
show all
Defined in:
lib/emma/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(percent, covered, total) ⇒ Coverage

Returns a new instance of Coverage.



137
138
139
# File 'lib/emma/report.rb', line 137

def initialize(percent, covered, total)
  @percent, @covered, @total = percent, covered, total
end

Instance Attribute Details

#coveredObject (readonly)

Returns the value of attribute covered.



135
136
137
# File 'lib/emma/report.rb', line 135

def covered
  @covered
end

#percentObject (readonly)

Returns the value of attribute percent.



135
136
137
# File 'lib/emma/report.rb', line 135

def percent
  @percent
end

#totalObject (readonly)

Returns the value of attribute total.



135
136
137
# File 'lib/emma/report.rb', line 135

def total
  @total
end

Instance Method Details

#as_json(opts = nil) ⇒ Object



141
142
143
144
145
146
147
# File 'lib/emma/report.rb', line 141

def as_json(opts = nil)
  {
    :percent => @percent,
    :covered => @covered,
    :total   => @total
  }
end

#to_json(*args) ⇒ Object



149
150
151
# File 'lib/emma/report.rb', line 149

def to_json(*args)
  as_json.to_json(*args)
end