Class: Capistrano::Callback
- Inherits:
-
Object
- Object
- Capistrano::Callback
- Defined in:
- lib/capistrano/callback.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#except ⇒ Object
readonly
Returns the value of attribute except.
-
#only ⇒ Object
readonly
Returns the value of attribute only.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #applies_to?(task) ⇒ Boolean
-
#initialize(source, options = {}) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(source, options = {}) ⇒ Callback
Returns a new instance of Callback.
5 6 7 8 9 10 |
# File 'lib/capistrano/callback.rb', line 5 def initialize(source, ={}) @source = source @options = @only = Array([:only]).map { |v| v.to_s } @except = Array([:except]).map { |v| v.to_s } end |
Instance Attribute Details
#except ⇒ Object (readonly)
Returns the value of attribute except.
3 4 5 |
# File 'lib/capistrano/callback.rb', line 3 def except @except end |
#only ⇒ Object (readonly)
Returns the value of attribute only.
3 4 5 |
# File 'lib/capistrano/callback.rb', line 3 def only @only end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/capistrano/callback.rb', line 3 def @options end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/capistrano/callback.rb', line 3 def source @source end |
Instance Method Details
#applies_to?(task) ⇒ Boolean
12 13 14 15 16 17 18 19 20 |
# File 'lib/capistrano/callback.rb', line 12 def applies_to?(task) if task && only.any? return only.include?(task.fully_qualified_name) elsif task && except.any? return !except.include?(task.fully_qualified_name) else return true end end |