Class: Noah::CustomWatcher

Inherits:
Object
  • Object
show all
Extended by:
Passthrough
Defined in:
lib/noah/custom_watcher.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Passthrough

passthrough

Constructor Details

#initializeCustomWatcher

Returns a new instance of CustomWatcher.



30
31
32
33
# File 'lib/noah/custom_watcher.rb', line 30

def initialize
  @my_redis ||= ENV['REDIS_URL']
  @my_pattern ||= '//noah'
end

Instance Attribute Details

#my_destinationObject

Returns the value of attribute my_destination.



22
23
24
# File 'lib/noah/custom_watcher.rb', line 22

def my_destination
  @my_destination
end

#my_patternObject

Returns the value of attribute my_pattern.



22
23
24
# File 'lib/noah/custom_watcher.rb', line 22

def my_pattern
  @my_pattern
end

#my_redisObject

Returns the value of attribute my_redis.



22
23
24
# File 'lib/noah/custom_watcher.rb', line 22

def my_redis
  @my_redis
end

Class Method Details

.destination(destination) ⇒ Object



43
44
45
# File 'lib/noah/custom_watcher.rb', line 43

def self.destination(destination)
  @my_destination = destination
end

.pattern(pattern) ⇒ Object



39
40
41
# File 'lib/noah/custom_watcher.rb', line 39

def self.pattern(pattern)
  @my_pattern = pattern
end

.redis_host(host) ⇒ Object



35
36
37
# File 'lib/noah/custom_watcher.rb', line 35

def self.redis_host(host)
  @my_redis = host
end

.run!Object



47
48
49
# File 'lib/noah/custom_watcher.rb', line 47

def self.run!
  @my_destination.nil? ? (raise ArgumentError) : run_watcher(@my_destination)
end

.watch(&blk) ⇒ Object



24
25
26
27
28
# File 'lib/noah/custom_watcher.rb', line 24

def self.watch(&blk)
  watcher = Noah::Watcher.new
  watcher.instance_eval(&blk) if block_given?
  watcher
end