Module: DcmDict::Encoder::DataToCode

Defined in:
lib/dcm_dict/encoder/data_to_code.rb

Class Method Summary collapse

Class Method Details

.data_element_data_to_code(data, indent = 4) ⇒ Object

Convert data element data to Ruby code using indent spaces indentation



30
31
32
33
34
# File 'lib/dcm_dict/encoder/data_to_code.rb', line 30

def self.data_element_data_to_code(data, indent=4)
  indent = 4 unless indent
  tag_ary_str = "[0x#{data[:tag_ary].tag_group_str},0x#{data[:tag_ary].tag_element_str}]"
  "#{' '*indent}{ tag_ps: '#{data[:tag_ps]}', tag_name: \"#{data[:tag_name]}\", tag_key: '#{data[:tag_key]}', tag_vr: #{data[:tag_vr]}, tag_vm: #{data[:tag_vm]}, tag_str: '#{data[:tag_str]}', tag_sym: #{data[:tag_sym].inspect}, tag_ndm: '#{data[:tag_ndm]}', tag_ary: #{tag_ary_str}, tag_multiple: #{data[:tag_multiple].inspect}, tag_note: '#{data[:tag_note]}'},"
end

Source data element footer



46
47
48
49
50
51
52
# File 'lib/dcm_dict/encoder/data_to_code.rb', line 46

def self.data_element_footer
  <<END
    ]
  end
end
END
end

.data_element_headerObject

Source data element header



37
38
39
40
41
42
43
# File 'lib/dcm_dict/encoder/data_to_code.rb', line 37

def self.data_element_header
  <<END
module DcmDict
  module SourceData
    DataElementsData = [
END
end

.uid_data_to_code(data, indent = 4) ⇒ Object

Convert uid data to Ruby code using indent spaces indentation



73
74
75
76
# File 'lib/dcm_dict/encoder/data_to_code.rb', line 73

def self.uid_data_to_code(data, indent=4)
  indent = 4 unless indent
  "#{' '*indent}{ uid_value: '#{data[:uid_value]}', uid_name: '#{data[:uid_name]}', uid_key: '#{data[:uid_key]}', uid_sym: #{data[:uid_sym].inspect}, uid_type: #{data[:uid_type].inspect}},"
end

Source uid footer



64
65
66
67
68
69
70
# File 'lib/dcm_dict/encoder/data_to_code.rb', line 64

def self.uid_footer
  <<END
    ]
  end
end
END
end

.uid_headerObject

Source uid header



55
56
57
58
59
60
61
# File 'lib/dcm_dict/encoder/data_to_code.rb', line 55

def self.uid_header
  <<END
module DcmDict
  module SourceData
    UidValuesData = [
END
end