Class: CallType

Inherits:
Object
  • Object
show all
Defined in:
lib/tbr/call_type.rb

Instance Method Summary collapse

Constructor Details

#initializeCallType



3
4
5
# File 'lib/tbr/call_type.rb', line 3

def initialize
  @types = Hash.new
end

Instance Method Details

#desc(code) ⇒ Object



20
21
22
# File 'lib/tbr/call_type.rb', line 20

def desc(code)
  @types[code] ? @types[code] : "Unknown service type - " + code
end

#load(filename) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/tbr/call_type.rb', line 7

def load(filename)
  file = File.new(filename)
  @types = Hash.new
  file.each_line do |line|
    fields = line.split(',')
    @types[fields[1]] = fields[3] if fields[0] == 'TC'  
  end
end

#sizeObject



16
17
18
# File 'lib/tbr/call_type.rb', line 16

def size
  @types.size
end