Class: Mate::TmProperties
- Inherits:
-
Object
- Object
- Mate::TmProperties
- Defined in:
- lib/mate/tm_properties.rb
Defined Under Namespace
Classes: Ignores
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(dir) ⇒ TmProperties
constructor
A new instance of TmProperties.
- #save ⇒ Object
Constructor Details
#initialize(dir) ⇒ TmProperties
Returns a new instance of TmProperties.
6 7 8 9 |
# File 'lib/mate/tm_properties.rb', line 6 def initialize(dir) @dir = Pathname(dir). @file = @dir + '.tm_properties' end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
5 6 7 |
# File 'lib/mate/tm_properties.rb', line 5 def dir @dir end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/mate/tm_properties.rb', line 5 def file @file end |
Instance Method Details
#save ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mate/tm_properties.rb', line 11 def save ignores = Ignores.new(dir) lines = if file.exist? file.readlines.reject do |line| line =~ Ignores::GENERATED_R end else [] end @file.open('w') do |f| f.puts ignores.lines f.puts lines end end |