Module: Statistrano::Config::RakeTaskWithContextCreation
- Included in:
- Statistrano::Config, Context
- Defined in:
- lib/statistrano/config/rake_task_with_context_creation.rb
Defined Under Namespace
Classes: Context
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/statistrano/config/rake_task_with_context_creation.rb', line 6 def self.included base base.module_eval do def user_task_namespaces @_user_task_namespaces ||= [] end def user_tasks @_user_tasks ||= [] end end end |
Instance Method Details
#namespace(namespace, &block) ⇒ Object
18 19 20 21 22 |
# File 'lib/statistrano/config/rake_task_with_context_creation.rb', line 18 def namespace namespace, &block context = Context.new (user_task_namespaces + [namespace]) context.instance_eval &block user_tasks.push *context.user_tasks end |
#task(name, desc = nil, &block) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/statistrano/config/rake_task_with_context_creation.rb', line 24 def task name, desc=nil, &block task = { name: name, namespaces: user_task_namespaces, block: block } task.merge!(desc: desc) if desc user_tasks.push task end |