Module: DatedBackup::DSL::Main

Defined in:
lib/dated_backup/dsl/main.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/dated_backup/dsl/main.rb', line 23

def method_missing sym, *args
  if RSYNC_OPTIONS.include?(sym)
    @hash[sym] = args
  else
    raise InvalidKeyError, "The key '#{sym}' is not a recognized expression"
  end
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



6
7
8
# File 'lib/dated_backup/dsl/main.rb', line 6

def hash
  @hash
end

#procsObject (readonly)

Returns the value of attribute procs.



6
7
8
# File 'lib/dated_backup/dsl/main.rb', line 6

def procs
  @procs
end

Instance Method Details

#after(&blk) ⇒ Object



18
19
20
21
# File 'lib/dated_backup/dsl/main.rb', line 18

def after &blk
  raise_without_block &blk
  @procs[:after] = blk
end

#before(&blk) ⇒ Object



13
14
15
16
# File 'lib/dated_backup/dsl/main.rb', line 13

def before &blk
  raise_without_block &blk
  @procs[:before] = blk
end

#initializeObject



8
9
10
11
# File 'lib/dated_backup/dsl/main.rb', line 8

def initialize
  @hash = {}
  @procs = {}
end