Sha256: 91c4dd13524cc610448b9ed67ee4b81bf3044dbd161f7d14f89b974badc600a3

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

include OpenEHR::RM::Support::Identification
include OpenEHR::RM::Common::Resource
include OpenEHR::RM::DataTypes::Text

module OpenEHR
  module Parser
    module ADLGrammar
      class Base < Treetop::Runtime::SyntaxNode

      end

      class ArchLanguage < Base
        def value
          Language.new(lang.value)
        end
      end


      class Language
        attr_reader :original_language, :translations
        
        def initialize(value)
          self.original_language = value['original_language']
          self.translations = value['translations']
        end
        
        def original_language=(original_language)
          @original_language = code2lang original_language
        end
        
        def translations=(translations)
          if translations.nil?
            @translations = nil
          else
            tr = translations.inject({ }) do |trans, lang|
              code, details  = lang
              td = TranslationDetails.new(
                     :language => code2lang(details['language']),
                     :author => details['author'],
                     :accreditation => details['accreditation'],
                     :other_details => details['other_details'])
              trans.update Hash[code, td]
            end
            @translations = tr
          end
        end
        
        protected
        def code2lang(code)
          ti, la = code.split '::'
          ti = TerminologyID.new(:value => ti)
          CodePhrase.new(:code_string => la, :terminology_id => ti)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open_ehr-0.9.5 lib/open_ehr/parser/adl.rb
open_ehr-0.9.4 lib/open_ehr/parser/adl.rb