module Batteries::Tasks
Public Instance Methods
default_tasks()
click to toggle source
# File lib/batteries/tasks.rb, line 20 def default_tasks %i(notes migrations secret) end
new(tasks: default_tasks) { |task_options| ... }
click to toggle source
# File lib/batteries/tasks.rb, line 10 def new(tasks: default_tasks) task_options = setup_task_options(tasks) yield task_options if block_given? tasks.each do |task| const_get(task.to_s.capitalize).new(options: task_options[task].to_h) end end
setup_task_options(tasks)
click to toggle source
# File lib/batteries/tasks.rb, line 24 def setup_task_options(tasks) tasks.each_with_object(OpenStruct.new) do |task, memo| memo.send("#{task}=", OpenStruct.new) end end