Class: WebServerConfigGenerator::Pathname
- Inherits:
-
Pathname
- Object
- Pathname
- WebServerConfigGenerator::Pathname
- Defined in:
- lib/web_server_config_generator/pathname.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#+(other) ⇒ Object
3 4 5 6 |
# File 'lib/web_server_config_generator/pathname.rb', line 3 def +(other) other = self.class.new(other) unless self.class === other self.class.new(plus(@path, other.to_s)) end |
#mkpath ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/web_server_config_generator/pathname.rb', line 8 def mkpath if $TEST_MODE puts "test mode: mkpath #{self}" else super end end |
#read ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/web_server_config_generator/pathname.rb', line 25 def read if self.exist? self.open("r") { |f| f.read } else "" end end |
#write(arg) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/web_server_config_generator/pathname.rb', line 16 def write(arg) if $TEST_MODE puts "test mode: write #{self}, #{arg.to_s[0, 100]}..." else FileUtils.mkdir_p File.dirname(self) self.open("w") { |f| f.write arg } end end |