class StartingBlocks::TextParser

Public Instance Methods

parse(text) click to toggle source
# File lib/starting_blocks/text_parser.rb, line 3
def parse(text)
  @text = text
  {
    tests:      greater_of([tests, runs]),
    assertions: assertions,
    failures:   failures,
    errors:     errors,
    skips:      skips
  }
end

Private Instance Methods

get_count_of(name) click to toggle source
# File lib/starting_blocks/text_parser.rb, line 20
def get_count_of name
  @text.scan(/(\d+ #{name})/)[-1][0].split(' ')[0].to_i
rescue
  0
end
greater_of(values) click to toggle source
# File lib/starting_blocks/text_parser.rb, line 26
def greater_of values
  values.sort_by { |x| x }.last
end
method_missing(meth, *args, &blk) click to toggle source
# File lib/starting_blocks/text_parser.rb, line 16
def method_missing(meth, *args, &blk)
  get_count_of meth.to_s
end