Class: AsciiDataTools::Editor
- Inherits:
-
Object
- Object
- AsciiDataTools::Editor
- Defined in:
- lib/ascii-data-tools/configuration.rb
Instance Method Summary collapse
- #[](n) ⇒ Object
- #changed?(n) ⇒ Boolean
- #edit ⇒ Object
-
#initialize(&edit_command) ⇒ Editor
constructor
A new instance of Editor.
Constructor Details
#initialize(&edit_command) ⇒ Editor
Returns a new instance of Editor.
126 127 128 129 130 131 |
# File 'lib/ascii-data-tools/configuration.rb', line 126 def initialize(&edit_command) @tempfiles = {} @preedit_mtimes = {} @postedit_mtimes = {} @edit_command = edit_command end |
Instance Method Details
#[](n) ⇒ Object
133 134 135 |
# File 'lib/ascii-data-tools/configuration.rb', line 133 def [](n) @tempfiles[n] ||= Tempfile.new("ascii_tools") end |
#changed?(n) ⇒ Boolean
144 145 146 |
# File 'lib/ascii-data-tools/configuration.rb', line 144 def changed?(n) not @preedit_mtimes[n] == @postedit_mtimes[n] end |
#edit ⇒ Object
137 138 139 140 141 142 |
# File 'lib/ascii-data-tools/configuration.rb', line 137 def edit close_all_tempfiles save_preedit_mtimes edit_files save_postedit_mtimes end |