Class: FileType

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/ontomde-core/fileTypes.rb

Overview

File types supported for round trip. Other File types may be added easily.

Constant Summary collapse

@@types =
Hash.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ FileType

Returns a new instance of FileType.



8
9
10
11
# File 'lib/ontomde-core/fileTypes.rb', line 8

def initialize(type)
  #puts "type=#{type}"
  @@types[type]=self
end

Instance Attribute Details

#re_beginObject (readonly)

Returns the value of attribute re_begin.



6
7
8
# File 'lib/ontomde-core/fileTypes.rb', line 6

def re_begin
  @re_begin
end

#re_endObject (readonly)

Returns the value of attribute re_end.



6
7
8
# File 'lib/ontomde-core/fileTypes.rb', line 6

def re_end
  @re_end
end

Class Method Details

.getFileType(fileName) ⇒ Object

Raises:



33
34
35
36
37
38
39
40
# File 'lib/ontomde-core/fileTypes.rb', line 33

def FileType.getFileType(fileName)
  ext=File.extname(fileName)
  type=@@types[ext]
  return type if ! type.nil?
  msg="Unknown File Type \"#{ext}\" for \"#{fileName}\""
  #log.debug(msg)
  raise WarningUnknownFileType.new(),msg
end

Instance Method Details

#beginMarker(str, id) ⇒ Object

Raises:



15
16
17
# File 'lib/ontomde-core/fileTypes.rb', line 15

def beginMarker(str,id)
  raise Warning.new(), 'Internal error. Undefined method'
end

#beginMarkerSkip(str, id) ⇒ Object

marker placeholder (for use instead of normal marker when shorter file is requested)



21
22
23
# File 'lib/ontomde-core/fileTypes.rb', line 21

def beginMarkerSkip(str,id)
  return "\n"
end

#endMarker(str) ⇒ Object

Raises:



24
25
26
# File 'lib/ontomde-core/fileTypes.rb', line 24

def endMarker(str)
  raise Warning.new(), 'Internal error. Undefined method'
end

#endMarkerSkip(str) ⇒ Object

marker placeholder (for use instead of normal marker when shorter file is requested)



30
31
32
# File 'lib/ontomde-core/fileTypes.rb', line 30

def endMarkerSkip(str)
  return "\n"
end

#escape(txt) ⇒ Object

escape text to be included in markers



42
43
44
# File 'lib/ontomde-core/fileTypes.rb', line 42

def escape(txt)
  return txt
end

#unescape(txt) ⇒ Object

unescape text to be read from markers



46
47
48
# File 'lib/ontomde-core/fileTypes.rb', line 46

def unescape(txt)
  return txt
end

#writeComment(str, writer) ⇒ Object

Raises:



12
13
14
# File 'lib/ontomde-core/fileTypes.rb', line 12

def writeComment(str,writer)
  raise Warning.new(), 'Internal error. Undefined method'
end