Class: Dressmaker::Configuration::Delegators::FileDelegator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Dressmaker::Configuration::Delegators::FileDelegator
- Defined in:
- lib/dressmaker/configuration/delegators.rb
Instance Method Summary collapse
- #append!(header) ⇒ Object
- #chmod(mode) ⇒ Object
- #gsub!(pattern, replace = nil, &block) ⇒ Object
- #make_executable! ⇒ Object
Instance Method Details
#append!(header) ⇒ Object
27 28 29 30 |
# File 'lib/dressmaker/configuration/delegators.rb', line 27 def append!(header) contents = File.read(self.path) File.open(self.path, 'w') {|f| f << header << contents } end |
#chmod(mode) ⇒ Object
19 20 21 |
# File 'lib/dressmaker/configuration/delegators.rb', line 19 def chmod(mode) File.chmod(mode, self.path) end |
#gsub!(pattern, replace = nil, &block) ⇒ Object
14 15 16 17 |
# File 'lib/dressmaker/configuration/delegators.rb', line 14 def gsub!(pattern, replace = nil, &block) contents = self.read.gsub(pattern, replace, &block) File.open(self.path, 'w') {|f| f << contents } end |
#make_executable! ⇒ Object
23 24 25 |
# File 'lib/dressmaker/configuration/delegators.rb', line 23 def make_executable! chmod(0755) end |