Module: StillLife
- Defined in:
- lib/still_life.rb,
lib/still_life/railtie.rb,
lib/still_life/version.rb,
lib/still_life/capybara_extension.rb,
lib/still_life/action_dispatch_extension.rb
Defined Under Namespace
Modules: ActionDispatchExtension, CapybaraExtension Classes: Railtie
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
Class Method Details
.draw(html) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/still_life.rb', line 9 def self.draw(html) location = caller.detect {|c| c =~ /^#{Rails.root}/}.remove(Rails.root.to_s, /:in .*$/).prepend("#{ENV['STILL_LIFE'] || ENV['STILLLIFE']}/") if html.present? pathname, i = Rails.root.join("tmp/html/#{location.tr(':', '-')}.html"), 1 while pathname.exist? i += 1 pathname = Rails.root.join("tmp/html/#{location.tr(':', '-')}_#{i}.html") end pathname.parent.mkpath pathname.write html end end |