Class: Wristwatch::Manifest

Inherits:
Hash
  • Object
show all
Defined in:
lib/wristwatch/manifest.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object (private)



24
25
26
27
28
29
30
# File 'lib/wristwatch/manifest.rb', line 24

def method_missing(meth, *args, &blk)
  if blk
    add_task(meth, *args, &blk)
  else
    super(meth, *args, &blk)
  end
end

Instance Method Details

#add_task(name, *args, &blk) ⇒ Object



9
10
11
12
# File 'lib/wristwatch/manifest.rb', line 9

def add_task(name, *args, &blk)
  self[name] = [] unless self[name].respond_to?(:<<)
  self[name] << build_task(*args, &blk)
end

#buildObject



4
5
6
7
# File 'lib/wristwatch/manifest.rb', line 4

def build
  instance_eval instructions
  self
end

#instructionsObject



14
15
16
# File 'lib/wristwatch/manifest.rb', line 14

def instructions
  File.read('config/wristwatch_jobs.rb')
end