Class: Providence::Eye

Inherits:
Object
  • Object
show all
Defined in:
lib/providence/eye.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(eval_context, *args) ⇒ Eye

Returns a new instance of Eye.



23
24
25
26
# File 'lib/providence/eye.rb', line 23

def initialize eval_context, *args
  @ec = eval_context
  @watchrs = args || []
end

Instance Attribute Details

#ecObject

Returns the value of attribute ec.



3
4
5
# File 'lib/providence/eye.rb', line 3

def ec
  @ec
end

#watchrsObject

Returns the value of attribute watchrs.



3
4
5
# File 'lib/providence/eye.rb', line 3

def watchrs
  @watchrs
end

Class Method Details

.get_image(image_name) ⇒ Object



6
7
8
# File 'lib/providence/eye.rb', line 6

def get_image(image_name)
  File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'images', 'glass', "#{image_name}.png")
end

.growl(message, image = info_image, title = 'Providence') ⇒ Object



18
19
20
# File 'lib/providence/eye.rb', line 18

def growl(message, image=info_image, title='Providence')
  Growl.notify message, :title => title, :icon => image
end

.method_missing(sym, *arguments, &block) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/providence/eye.rb', line 10

def method_missing(sym, *arguments, &block)
  if sym.to_s =~ /^(.*)_image$/
    get_image($1)
  else
    super
  end
end

Instance Method Details

#run_suiteObject



28
29
30
# File 'lib/providence/eye.rb', line 28

def run_suite
  watchrs.each {|w| w.class.run_all }
end

#watchObject



32
33
34
# File 'lib/providence/eye.rb', line 32

def watch
  watchrs.each {|w| w.watch(ec) }
end