Sha256: e07620530ad8e5488a15d448140ff5b5b16bfd7e0526b8351a584e116fc87003

Contents?: true

Size: 1.62 KB

Versions: 9

Compression:

Stored size: 1.62 KB

Contents

# This module is implemented from this UML:
#http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109701308832_384250_6986Report.html
# Ticket refs #46
require 'uri/generic'

module URI
  class EHR < ::URI::Generic
    COMPONENT = [
      :scheme, :path, :fragment, :query
    ].freeze

    def self.build(args)
      tmp = Util::make_components_hash(self, args)
      super(tmp)
    end

    def initialize(*arg)
      super(*arg)
    end

    def self.use_registry
      true
    end
  end
  @@schemes['EHR'] = EHR
end

module OpenEHR
  module RM
    module DataTypes
      module URI
        class DvUri < OpenEHR::RM::DataTypes::Basic::DataValue
          def initialize(args = {})
            self.value = args[:value]
          end

          def value
            @value.to_s
          end

          def fragment_id
            @value.fragment
          end

          def path
            @value.path
          end

          def query
            @value.query
          end

          def scheme
            @value.scheme
          end

          def value=(value)
            raise ArgumentError, "value is empty" if value.nil?
            parse(value)
          end

          private

          def parse(value)
            @value = ::URI.parse(value)
          end
        end

        class DvEhrUri < DvUri
          def initialize(value)
            super(value)
          end

          def value=(value)
            raise ArgumentError, "scheme must be ehr" if !(value =~ /^ehr/i)
            @value = parse(value)
          end
        end # of DV_EHR_URI
      end # of URI
    end # of DataTypes
  end # of RM
end # of OpenEHR

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
open_ehr-1.0.1 lib/open_ehr/rm/data_types/uri.rb
open_ehr-1.0.0 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.9.5 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.9.4 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.9.3 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.9.2 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.9.1 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.9.0 lib/open_ehr/rm/data_types/uri.rb
open_ehr-0.6.1 lib/open_ehr/rm/data_types/uri.rb