class JobParser::Match

Attributes

score[R]
str[RW]
worth[RW]

Public Class Methods

new(str, worth, score = 0) click to toggle source
# File lib/jobparser/scorer.rb, line 37
def initialize(str, worth, score = 0)
  @str = str
  @score = score
  @worth = worth
end

Public Instance Methods

and_score_now() click to toggle source
# File lib/jobparser/scorer.rb, line 57
def and_score_now
  @score += @worth
  self
end
if_block_true() { || ... } click to toggle source
# File lib/jobparser/scorer.rb, line 51
def if_block_true(&block)
  res = yield
  @score += @worth if res
  res
end
if_regex_match(reg, str) click to toggle source
# File lib/jobparser/scorer.rb, line 43
def if_regex_match(reg, str)
  reg.match(str) {
    @score += @worth
    true
  }
  false
end