Module: Snarl::SNP::AutoSNP
- Included in:
- Autotest::Snarl
- Defined in:
- lib/snarl/snp/autosnp.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
- #icon_fail ⇒ Object
-
#icon_ok ⇒ Object
%HOME%Application Datafull phatsnarlstylesok.png works fine.
- #icon_pending ⇒ Object
-
#icondir ⇒ Object
Windows Snarl shortcut’s “working folder” (left click property) %HOME%Application Datafull phatsnarlstyles.
-
#port ⇒ Object
Returns the value of attribute port.
- #timeout_fail ⇒ Object
- #timeout_ok ⇒ Object
Instance Method Summary collapse
- #classname(state) ⇒ Object
- #snarl(title, text, state) ⇒ Object
- #snp ⇒ Object
- #timeout(state) ⇒ Object
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
14 15 16 |
# File 'lib/snarl/snp/autosnp.rb', line 14 def host @host end |
#icon_fail ⇒ Object
40 |
# File 'lib/snarl/snp/autosnp.rb', line 40 def icon_fail ; @icon_fail ||= "fail.png" ; end |
#icon_ok ⇒ Object
%HOME%Application Datafull phatsnarlstylesok.png works fine
39 |
# File 'lib/snarl/snp/autosnp.rb', line 39 def icon_ok ; @icon_ok ||= "ok.png" ; end |
#icon_pending ⇒ Object
41 |
# File 'lib/snarl/snp/autosnp.rb', line 41 def icon_pending ; @icon_pending ||= "pending.png" ; end |
#icondir ⇒ Object
Windows Snarl shortcut’s “working folder” (left click property) %HOME%Application Datafull phatsnarlstyles
36 |
# File 'lib/snarl/snp/autosnp.rb', line 36 def icondir ; @icondir ||= './' ; end |
#port ⇒ Object
Returns the value of attribute port.
14 15 16 |
# File 'lib/snarl/snp/autosnp.rb', line 14 def port @port end |
#timeout_fail ⇒ Object
44 |
# File 'lib/snarl/snp/autosnp.rb', line 44 def timeout_fail ; @timeout_fail ||= 10 ; end |
#timeout_ok ⇒ Object
43 |
# File 'lib/snarl/snp/autosnp.rb', line 43 def timeout_ok ; @timeout_ok ||= 5 ; end |
Instance Method Details
#classname(state) ⇒ Object
54 55 56 |
# File 'lib/snarl/snp/autosnp.rb', line 54 def classname(state) state.to_s end |
#snarl(title, text, state) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/snarl/snp/autosnp.rb', line 58 def snarl(title, text, state) snp.notification( :title => title, :text => text, :icon => state.to_s, :timeout => timeout(state), :class => classname(state) ) end |
#snp ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/snarl/snp/autosnp.rb', line 17 def snp Snarl::SNP.load("host : \#{host}\nport : \#{port}\napp : Autotest::Snarl\n\"class\" :\n - ['green', 'test ok']\n - ['red', 'test fail']\n - ['yellow', 'test pending']\n - ['info', 'system message']\niconset :\n green : \#{File.join(icondir, icon_ok)}\n red : \#{File.join(icondir, icon_fail)}\n yellow : \#{File.join(icondir, icon_pending)}\n") end |
#timeout(state) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/snarl/snp/autosnp.rb', line 46 def timeout(state) case state when :green then timeout_ok.to_i when :red then timeout_fail.to_i else 5 end end |