Sha256: 590962191de0377cfe5688f1b3348fb7ba2fccd65bf8a4cec865667952b2a5c1

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

#
#  Copyright (C) 2014-2021  Enrico Rivarola
#
#  This file is part of DcmDict gem (dcm_dict).
#
#  DcmDict is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  DcmDict is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with DcmDict.  If not, see <http://www.gnu.org/licenses/>.
#
#  This software has neither been tested nor approved for clinical use
#  or for incorporation in a medical device.
#  It is the redistributor's or user's responsibility to comply with any
#  applicable local, state, national or international regulations.
#
module DcmDict
  module XML

    # Base class to manage xml data
    class FieldData
      using DcmDict::Refine::Internal::StringRefineInternal

      # Initialize object using +extract_proc+ as proc to extract data from xml element
      def initialize(extract_proc)
        @extract_proc = extract_proc
      end

      private
      def extract_multiple_data(key, sep)
        extract_content_data(key).split(sep)
      end

      def extract_content_data(key)
        data = @extract_proc.call(key)
        data ? data.dcm_unspace : ''
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dcm_dict-0.36.0 lib/dcm_dict/xml/field_data.rb
dcm_dict-0.35.0 lib/dcm_dict/xml/field_data.rb
dcm_dict-0.34.0 lib/dcm_dict/xml/field_data.rb
dcm_dict-0.33.0 lib/dcm_dict/xml/field_data.rb
dcm_dict-0.32.0 lib/dcm_dict/xml/field_data.rb