Sha256: 42abb28b659ff44aeae9326e4ab6a824ed5b1bf29fae13ee6781d483437654f1

Contents?: true

Size: 1.62 KB

Versions: 17

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
          end

          def fragment_id
            @uri.fragment
          end

          def path
            @uri.path
          end

          def query
            @uri.query
          end

          def scheme
            @uri.scheme
          end

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

          protected

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

        class DvEhrUri < DvUri
          def initialize(value)
            super
          end

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

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
openehr-1.2.8 lib/openehr/rm/data_types/uri.rb
openehr-1.2.7 lib/openehr/rm/data_types/uri.rb
openehr-1.2.6 lib/openehr/rm/data_types/uri.rb
openehr-1.2.5 lib/openehr/rm/data_types/uri.rb
openehr-1.2.4 lib/openehr/rm/data_types/uri.rb
openehr-1.2.3 lib/openehr/rm/data_types/uri.rb
openehr-1.2.2 lib/openehr/rm/data_types/uri.rb
openehr-1.2.1 lib/openehr/rm/data_types/uri.rb
openehr-1.2.0 lib/openehr/rm/data_types/uri.rb
openehr-1.1.6 lib/openehr/rm/data_types/uri.rb
openehr-1.1.5 lib/openehr/rm/data_types/uri.rb
openehr-1.1.4 lib/openehr/rm/data_types/uri.rb
openehr-1.1.3 lib/openehr/rm/data_types/uri.rb
openehr-1.1.2 lib/openehr/rm/data_types/uri.rb
openehr-1.1.1 lib/openehr/rm/data_types/uri.rb
openehr-1.1.0 lib/openehr/rm/data_types/uri.rb
open_ehr-1.0.2 lib/open_ehr/rm/data_types/uri.rb