Class: FileType
- Includes:
- Singleton
- Defined in:
- lib/ontomde-core/fileTypes.rb
Overview
File types supported for round trip. Other File types may be added easily.
Direct Known Subclasses
FileTypeJSP, FileTypeJava, FileTypeJavaProperties, FileTypeXML
Constant Summary collapse
- @@types =
Hash.new
Instance Attribute Summary collapse
-
#re_begin ⇒ Object
readonly
Returns the value of attribute re_begin.
-
#re_end ⇒ Object
readonly
Returns the value of attribute re_end.
Class Method Summary collapse
Instance Method Summary collapse
- #beginMarker(str, id) ⇒ Object
-
#beginMarkerSkip(str, id) ⇒ Object
marker placeholder (for use instead of normal marker when shorter file is requested).
- #endMarker(str) ⇒ Object
-
#endMarkerSkip(str) ⇒ Object
marker placeholder (for use instead of normal marker when shorter file is requested).
-
#escape(txt) ⇒ Object
escape text to be included in markers.
-
#initialize(type) ⇒ FileType
constructor
A new instance of FileType.
-
#unescape(txt) ⇒ Object
unescape text to be read from markers.
- #writeComment(str, writer) ⇒ Object
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_begin ⇒ Object (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_end ⇒ Object (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
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
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
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 |