Class: MarkdownExec::FileInMenu
Class Method Summary collapse
-
.for_menu(filename) ⇒ String
Prepends the age of the file in days to the file name for display in a menu.
-
.from_menu(filename_with_age) ⇒ String
Removes the age from the string to retrieve the original file name.
Class Method Details
.for_menu(filename) ⇒ String
Prepends the age of the file in days to the file name for display in a menu.
111 112 113 114 115 |
# File 'lib/markdown_exec.rb', line 111 def self.(filename) file_age = (Time.now - File.mtime(filename)) / (60 * 60 * 24 * 30) " #{Histogram.display(file_age, 0, 11, 12, inverse: false)}: #{filename}" end |
.from_menu(filename_with_age) ⇒ String
Removes the age from the string to retrieve the original file name.
120 121 122 |
# File 'lib/markdown_exec.rb', line 120 def self.(filename_with_age) filename_with_age.split(': ', 2).last end |