Module: CI::Reporter::StructureXmlHelpers
Instance Method Summary collapse
-
#attr_hash ⇒ Object
Struct#to_h is not available in Ruby 1.9.
-
#cleaned_attributes ⇒ Object
Removes empty attributes and truncates long attributes.
- #truncate_at_newline(txt) ⇒ Object
Instance Method Details
#attr_hash ⇒ Object
Struct#to_h is not available in Ruby 1.9
10 11 12 |
# File 'lib/ci/reporter/test_suite.rb', line 10 def attr_hash Hash[self.members.zip(self.values)] end |
#cleaned_attributes ⇒ Object
Removes empty attributes and truncates long attributes.
15 16 17 18 19 20 |
# File 'lib/ci/reporter/test_suite.rb', line 15 def cleaned_attributes attr_array = attr_hash .reject {|k,v| v.to_s.empty? } .map {|k,v| [k, truncate_at_newline(v)] } Hash[attr_array] end |
#truncate_at_newline(txt) ⇒ Object
22 23 24 |
# File 'lib/ci/reporter/test_suite.rb', line 22 def truncate_at_newline(txt) txt.to_s.sub(/\n.*/m, '...') end |