Class: Capistrano::Baptize::PolicyDefinition
- Inherits:
-
Object
- Object
- Capistrano::Baptize::PolicyDefinition
- Defined in:
- lib/baptize/dsl.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(role, parent) ⇒ PolicyDefinition
constructor
A new instance of PolicyDefinition.
- #method_missing(sym, *args, &block) ⇒ Object
- #requires(*tasks) ⇒ Object
- #respond_to?(sym, include_priv = false) ⇒ Boolean
Constructor Details
#initialize(role, parent) ⇒ PolicyDefinition
Returns a new instance of PolicyDefinition.
11 12 13 14 15 |
# File 'lib/baptize/dsl.rb', line 11 def initialize(role, parent) @role = role @dependencies = [] @parent = parent end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/baptize/dsl.rb', line 21 def method_missing(sym, *args, &block) if @parent.respond_to?(sym) @parent.send(sym, *args, &block) else super end end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
9 10 11 |
# File 'lib/baptize/dsl.rb', line 9 def dependencies @dependencies end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
9 10 11 |
# File 'lib/baptize/dsl.rb', line 9 def role @role end |
Instance Method Details
#full_name ⇒ Object
29 30 31 |
# File 'lib/baptize/dsl.rb', line 29 def full_name "baptize:policies:#{role}" end |
#requires(*tasks) ⇒ Object
33 34 35 36 37 |
# File 'lib/baptize/dsl.rb', line 33 def requires(*tasks) Array(tasks).flatten.each do |name| @dependencies << (name.kind_of?(Symbol) ? "baptize:packages:#{name}" : name.to_s) end end |
#respond_to?(sym, include_priv = false) ⇒ Boolean
17 18 19 |
# File 'lib/baptize/dsl.rb', line 17 def respond_to?(sym, include_priv = false) super || @parent.respond_to?(sym, include_priv) end |