Sha256: d4ebbf9d3b6e2c1ffcd446c39bcda938f80cc87729fc74380264f46d615f647e

Contents?: true

Size: 1.38 KB

Versions: 75

Compression:

Stored size: 1.38 KB

Contents

module HQMF
  
  module Converter
  
    class SimpleRestriction

      include HQMF::Conversion::Utilities
    
      attr_accessor :operator, :target, :preconditions, :negation, :converted, :generated_data_criteria
      def initialize(operator, target, preconditions = [])
        @operator = operator
        @target = target
        @preconditions = preconditions
      end
    
      # Create a new population criteria from a JSON hash keyed off symbols
      def self.from_json(json)
        raise "not implemented"
      end
      
      def klass
        "RESTRICTION"
      end
      
      def comparison?
        false
      end
      def restriction?
        true
      end

      def has_preconditions?
        preconditions and !preconditions.empty?
      end
      
      def single_target?
        !target.nil?
      end
      def multi_target?
        has_preconditions?
      end
      
      def restrictions
        preconditions.select {|precondition| precondition.restriction?}
      end
      
      def to_json
        x = nil
        json = {}
        json[:klass] = klass
        json[:operator] = @operator.to_json if @operator
        json[:target] = @target if @target
        json[:negation] = @negation if @negation
        if (@preconditions)
          json[:preconditions] = x if x = json_array(@preconditions)
        end
        json
      end
    
    end
  end
  
  
end

Version data entries

75 entries across 75 versions & 3 rubygems

Version Path
health-data-standards-3.2.0 lib/hqmf-parser/converter/pass1/simple_restriction.rb
health-data-standards-3.1.1 lib/hqmf-parser/converter/pass1/simple_restriction.rb
health-data-standards-3.1.0 lib/hqmf-parser/converter/pass1/simple_restriction.rb
health-data-standards-3.0.6 lib/hqmf-parser/converter/pass1/simple_restriction.rb
health-data-standards-3.0.5 lib/hqmf-parser/converter/pass1/simple_restriction.rb
health-data-standards-3.0.4 lib/hqmf-parser/converter/pass1/simple_restriction.rb
health-data-standards-3.0.3 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.1.0 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.6 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.5 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.4 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.3 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.2 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.1 lib/hqmf-parser/converter/pass1/simple_restriction.rb
hqmf-parser-1.0.0 lib/hqmf-parser/converter/pass1/simple_restriction.rb