Module: Commenter::DispositionStatus

Defined in:
lib/commenter/disposition_status.rb

Overview

Canonical disposition vocabulary, shared by cell shading (Filler) and ballot statistics (BallotReport). Matches free-text observations and OSD's structured resolution_status values. One home for the question "what counts as an accepted disposition".

Constant Summary collapse

PATTERNS =
[
  [:accept_with_modifications, /awm|accept(ed)?[ ,]*with +(modifications|changes)/].freeze,
  [:rejected, /reject(ed)?|not accepted/].freeze,
  [:accepted, /accept(ed)?/].freeze,
  [:noted, /noted/].freeze,
  [:todo, /todo/].freeze
].freeze

Class Method Summary collapse

Class Method Details

.match(text) ⇒ Object

Returns the canonical status symbol for the given text, or nil when nothing matches. Order matters: "accept with modifications" and "not accepted" must be classified before the bare "accept" pattern.



22
23
24
25
26
27
28
29
30
31
# File 'lib/commenter/disposition_status.rb', line 22

def match(text)
  value = text.to_s.downcase.strip
  return nil if value.empty?

  PATTERNS.each do |status, pattern|
    return status if value.match?(pattern)
  end

  nil
end

.statusesObject



33
34
35
# File 'lib/commenter/disposition_status.rb', line 33

def statuses
  PATTERNS.map(&:first)
end