Module: ActsAsEcv::ClassMethods

Defined in:
lib/acts_as_ecv.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_ecv(attr = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/acts_as_ecv.rb', line 7

def acts_as_ecv(attr={})
  up_txt = attr[:up_txt] || "SYSTEM UP"
  down_txt = attr[:down_txt] || "SYSTEM DOWN"
  down_file = attr[:down_file] || File.join("public", "system", "down")
  define_method('index') do
    # Check if app has been marked as down
    if File.exists?(down_file)
      render :text => down_txt
    else
      render :text => up_txt
    end
  end
end