Module: TrovoBot::Common
- Defined in:
- lib/trovobot/common.rb
Class Method Summary collapse
Class Method Details
.cache_text(filename, update = false) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/trovobot/common.rb', line 6 def self.cache_text filename, update = false if !update && File.exist?(filename) File.read filename else yield.tap{ |_| FileUtils.mkdir_p File.dirname filename; File.write filename, _ } end end |