Class: XmlToGdlController
- Inherits:
-
Object
- Object
- XmlToGdlController
- Defined in:
- lib/xmlutils/xmltogdlcontroller.rb
Instance Attribute Summary collapse
-
#destPath ⇒ Object
readonly
Returns the value of attribute destPath.
-
#srcPath ⇒ Object
readonly
Returns the value of attribute srcPath.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #addInclude(arg) ⇒ Object
- #doSomething ⇒ Object
-
#initialize ⇒ XmlToGdlController
constructor
A new instance of XmlToGdlController.
- #noCmdLineArg ⇒ Object
- #setFilenames(arg) ⇒ Object
- #setVerbose(arg) ⇒ Object
Constructor Details
#initialize ⇒ XmlToGdlController
Returns a new instance of XmlToGdlController.
19 20 21 22 23 24 25 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 19 def initialize() $LOG.debug "XmlToGdlController::initialize" @verbose = false @srcPath = "" @destPath = "" @includes = [] end |
Instance Attribute Details
#destPath ⇒ Object (readonly)
Returns the value of attribute destPath.
17 18 19 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 17 def destPath @destPath end |
#srcPath ⇒ Object (readonly)
Returns the value of attribute srcPath.
16 17 18 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 16 def srcPath @srcPath end |
#verbose ⇒ Object
Returns the value of attribute verbose.
15 16 17 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 15 def verbose @verbose end |
Instance Method Details
#addInclude(arg) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 70 def addInclude(arg) $LOG.debug "XmlToGdlController::addInclude( #{arg} )" arg = File.rubypath(arg) if(!File.file?(arg)) arg = File.(arg) if(!File.file?(arg)) $LOG.error "Unable to find include file: #{arg}" puts "Missing file: #{arg}" arg = nil end end if(nil != arg) @includes << arg $LOG.info "Include file added: #{arg}" end end |
#doSomething ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 28 def doSomething() $LOG.debug "XmlToGdlController::doSomething" = {} ["verbose"] = @verbose destFile = "" destFile = File.basename(@destPath) unless File.directory?(@destPath) if(!destFile.empty?) [:destfile] = destFile end destDir = @destPath # Extract the dir if it is a file path. destDir = File.dirname(@destPath) unless File.directory?(@destPath) if(destDir.length() < 1) destDir = Dir.getwd() # Use working dir if nothing there. end [:destdir] = destDir [:includes] = @includes # Go to work. docBuilder = GdlDocBuilder.new() docBuilder.createDocument(@srcPath) end |
#noCmdLineArg ⇒ Object
88 89 90 91 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 88 def noCmdLineArg() $LOG.debug "XmlToGdlController::noCmdLineArg" #exit "Should never reach here." end |
#setFilenames(arg) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 60 def setFilenames(arg) $LOG.debug "XmlToGdlController::setFilenames( #{arg} )" @srcPath = arg[0] @destPath = arg[1] @srcPath = File.rubypath(@srcPath) @destPath = File.rubypath(@destPath) end |
#setVerbose(arg) ⇒ Object
54 55 56 57 |
# File 'lib/xmlutils/xmltogdlcontroller.rb', line 54 def setVerbose(arg) $LOG.debug "XmlToGdlController::setVerbose( #{arg} )" @verbose = arg end |