Class: Rack::Rsync

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/rsync.rb,
lib/rack/rsync/version.rb

Constant Summary collapse

VERSION =
"0.2.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, source, destination, *options, &condition) ⇒ Rsync

Returns a new instance of Rsync.



7
8
9
10
11
12
13
# File 'lib/rack/rsync.rb', line 7

def initialize(app, source, destination, *options, &condition)
  @app         = app
  @source      = source
  @destination = destination
  @options     = [*options]
  @condition   = condition || Proc.new { true }
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



5
6
7
# File 'lib/rack/rsync.rb', line 5

def destination
  @destination
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/rack/rsync.rb', line 5

def options
  @options
end

#sourceObject (readonly)

Returns the value of attribute source.



5
6
7
# File 'lib/rack/rsync.rb', line 5

def source
  @source
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
# File 'lib/rack/rsync.rb', line 15

def call(env)
  res = @app.call(env)
  sync if should_run?(env)
  res
end