Class: Tools

Inherits:
Object
  • Object
show all
Defined in:
lib/keytechKit/tools.rb

Class Method Summary collapse

Class Method Details

.class_key(element_key) ⇒ Object

Returns a classkey (MISC_FILE) from a elementkey (MISC_FILE:1234)



4
5
6
# File 'lib/keytechKit/tools.rb', line 4

def self.class_key(element_key)
  element_key.split(':').first
end

.class_type(element_key) ⇒ Object

Return a classkey (MI, FD, DO) from a elementkey (MISC_FILE:!234)



9
10
11
12
13
14
15
16
# File 'lib/keytechKit/tools.rb', line 9

def self.class_type(element_key)
  class_key = class_key(element_key)
  return 'MI' if class_key.upcase.end_with?('_MI')

  return 'FD' if class_key.end_with?('_FD', '_WF')

  'DO'
end