Method: String#to_element_method

Defined in:
lib/dicom/ruby_extensions.rb

#to_element_methodSymbol

Converts the string to a proper DICOM element method name symbol.

Returns:

  • a DICOM element method name



128
129
130
# File 'lib/dicom/ruby_extensions.rb', line 128

def to_element_method
  self.gsub(/^3/,'three_').gsub(/[#*?!]/,' ').gsub(', ',' ').gsub('&','and').gsub(' - ','_').gsub(' / ','_').gsub(/[\s\-\.\,\/\\]/,'_').gsub(/[\(\)\']/,'').gsub(/\_+/, '_').downcase.to_sym
end