Class: Capistrano::Command::Tree::ConditionBranch::Evaluator
- Inherits:
-
Object
- Object
- Capistrano::Command::Tree::ConditionBranch::Evaluator
- Defined in:
- lib/capistrano/command.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #in?(role) ⇒ Boolean
-
#initialize(config, condition, server) ⇒ Evaluator
constructor
A new instance of Evaluator.
- #method_missing(sym, *args, &block) ⇒ Object
- #result ⇒ Object
Constructor Details
#initialize(config, condition, server) ⇒ Evaluator
Returns a new instance of Evaluator.
61 62 63 64 65 |
# File 'lib/capistrano/command.rb', line 61 def initialize(config, condition, server) @configuration = config @condition = condition @server = server end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/capistrano/command.rb', line 75 def method_missing(sym, *args, &block) if server.respond_to?(sym) server.send(sym, *args, &block) elsif configuration.respond_to?(sym) configuration.send(sym, *args, &block) else super end end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
59 60 61 |
# File 'lib/capistrano/command.rb', line 59 def condition @condition end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
59 60 61 |
# File 'lib/capistrano/command.rb', line 59 def configuration @configuration end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
59 60 61 |
# File 'lib/capistrano/command.rb', line 59 def server @server end |
Instance Method Details
#in?(role) ⇒ Boolean
67 68 69 |
# File 'lib/capistrano/command.rb', line 67 def in?(role) configuration.roles[role].include?(server) end |
#result ⇒ Object
71 72 73 |
# File 'lib/capistrano/command.rb', line 71 def result eval(condition, binding) end |