Sha256: 59aa9de28baa9817ebc20bd2250e5f366accfbc4c2ac385e74e30550210489ae

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Clinical
  class Status
    STATUSES = [
      :not_yet_recruiting, 
      :recruiting,
      :enrolling_by_invitation,
      :active,
      :not_recruiting, 
      :completed, 
      :suspended, 
      :terminated, 
      :withdrawn, 
      :available, 
      :no_longer_available
    ]

    OPEN_STATUSES = [
      :not_yet_recruiting,
      :recruiting
    ]

    attr_reader :name

    def initialize(sym)
      @name = sym
    end

    def open?
      OPEN_STATUSES.include?(name)
    end

    def to_s
      sym.to_s
    end

    class << self
      def parse(s)
        s.nil? ? nil : Status.new(s.downcase.gsub(" ", "_").to_sym)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dpickett-clinical-0.1.0 lib/clinical/status.rb