Class: UICov::CovData
- Inherits:
-
Object
- Object
- UICov::CovData
- Defined in:
- lib/uicov/coverage/data.rb
Instance Attribute Summary collapse
-
#input_files ⇒ Object
readonly
Returns the value of attribute input_files.
-
#screens ⇒ Object
readonly
Returns the value of attribute screens.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #add_covered_screen(name) ⇒ Object
- #add_input_file(filename, filedate) ⇒ Object
- #add_screen(name) ⇒ Object
-
#initialize(cov_file = nil) ⇒ CovData
constructor
A new instance of CovData.
- #save(filename) ⇒ Object
- #set_processing_date(date = Time.now) ⇒ Object
Constructor Details
#initialize(cov_file = nil) ⇒ CovData
Returns a new instance of CovData.
14 15 16 17 18 19 |
# File 'lib/uicov/coverage/data.rb', line 14 def initialize(cov_file=nil) @type = CoverageDataType::UNKNOWN @input_files = {} @screens = {} load(cov_file) unless cov_file.nil? end |
Instance Attribute Details
#input_files ⇒ Object (readonly)
Returns the value of attribute input_files.
7 8 9 |
# File 'lib/uicov/coverage/data.rb', line 7 def input_files @input_files end |
#screens ⇒ Object (readonly)
Returns the value of attribute screens.
7 8 9 |
# File 'lib/uicov/coverage/data.rb', line 7 def screens @screens end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/uicov/coverage/data.rb', line 8 def type @type end |
Class Method Details
.load(filename) ⇒ Object
10 11 12 |
# File 'lib/uicov/coverage/data.rb', line 10 def self.load(filename) YAML.load_file(filename) end |
Instance Method Details
#add_covered_screen(name) ⇒ Object
29 30 31 32 33 |
# File 'lib/uicov/coverage/data.rb', line 29 def add_covered_screen(name) scd = add_screen name scd.hit return scd end |
#add_input_file(filename, filedate) ⇒ Object
35 36 37 |
# File 'lib/uicov/coverage/data.rb', line 35 def add_input_file(filename, filedate) @input_files[filename] = filedate end |
#add_screen(name) ⇒ Object
25 26 27 |
# File 'lib/uicov/coverage/data.rb', line 25 def add_screen(name) @screens[name] ||= ScreenData.new name end |
#save(filename) ⇒ Object
39 40 41 42 |
# File 'lib/uicov/coverage/data.rb', line 39 def save(filename) File.open(filename, 'w') { |f| f.write YAML.dump(self) } Log.info "Result saved to '#{File.(filename)}'" end |
#set_processing_date(date = Time.now) ⇒ Object
21 22 23 |
# File 'lib/uicov/coverage/data.rb', line 21 def set_processing_date(date=Time.now) @data_gathered_at = date.strftime('%F %R:%S.%3N') end |