Class: Delphi::Resource
- Inherits:
-
Object
- Object
- Delphi::Resource
- Defined in:
- lib/delphi/resource.rb
Overview
Class to encapsulate an RC file.
Instance Attribute Summary collapse
-
#haltonfail ⇒ Object
Returns the value of attribute haltonfail.
-
#rcfile ⇒ Object
readonly
Returns the value of attribute rcfile.
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(rcfile, dproj_version, halt_on_fail = true) ⇒ Resource
constructor
You need to tell this class what version of Delphi to use, because there is no metadata in an rc file that it can use to determine it.
- #output ⇒ Object
Constructor Details
#initialize(rcfile, dproj_version, halt_on_fail = true) ⇒ Resource
You need to tell this class what version of Delphi to use, because there is no metadata in an rc file that it can use to determine it.
14 15 16 17 18 |
# File 'lib/delphi/resource.rb', line 14 def initialize(rcfile, dproj_version, halt_on_fail = true) @rcfile = rcfile @haltonfail = halt_on_fail @compiler = Delphi::Compiler.new(dproj_version) end |
Instance Attribute Details
#haltonfail ⇒ Object
Returns the value of attribute haltonfail.
9 10 11 |
# File 'lib/delphi/resource.rb', line 9 def haltonfail @haltonfail end |
#rcfile ⇒ Object (readonly)
Returns the value of attribute rcfile.
10 11 12 |
# File 'lib/delphi/resource.rb', line 10 def rcfile @rcfile end |
Instance Method Details
#compile ⇒ Object
20 21 22 23 |
# File 'lib/delphi/resource.rb', line 20 def compile output = @compiler.compile_rc(@rcfile) fail "Error compiling #{@rcfile}:\n#{output}" if @haltOnFail && !$CHILD_STATUS end |
#output ⇒ Object
25 26 27 |
# File 'lib/delphi/resource.rb', line 25 def output File.join(File.dirname(@rcfile), File.basename(@rcfile, '.rc') + '.res') end |