Class: Ralf::Log
- Inherits:
-
Object
- Object
- Ralf::Log
- Defined in:
- lib/ralf/log.rb
Instance Method Summary collapse
-
#initialize(key, targetprefix) ⇒ Log
constructor
A new instance of Log.
- #name ⇒ Object
- #save_to_dir(dir, use_cache = true) ⇒ Object
Constructor Details
#initialize(key, targetprefix) ⇒ Log
Returns a new instance of Log.
3 4 5 6 |
# File 'lib/ralf/log.rb', line 3 def initialize(key, targetprefix) @key = key @targetprefix = targetprefix end |
Instance Method Details
#name ⇒ Object
8 9 10 |
# File 'lib/ralf/log.rb', line 8 def name @key.name.gsub(@targetprefix, '') end |
#save_to_dir(dir, use_cache = true) ⇒ Object
12 13 14 15 16 |
# File 'lib/ralf/log.rb', line 12 def save_to_dir(dir, use_cache = true) file = File.join(dir, name) File.open(file, 'w') { |f| f.write(@key.data) } unless use_cache and File.exist?(file) file # return saved filename end |