Class: Webtask::TaskWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/webtask/task_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#has_options_for?(arg_name) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/webtask/task_wrapper.rb', line 3

def has_options_for?(arg_name)
  !!options[arg_name.to_sym]
end

#optionsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/webtask/task_wrapper.rb', line 11

def options
  arg_names.each_with_object({}) do |arg_name, options|
    if __getobj__.respond_to?(:options_for, true)
      if options_for_arg_name = __getobj__.send(:options_for, arg_name)
        options[arg_name.to_sym] = options_for_arg_name
      else
        next
      end
    else
      next
    end
  end
end

#shell_command(args:) ⇒ Object



7
8
9
# File 'lib/webtask/task_wrapper.rb', line 7

def shell_command(args:)
  "bundle exec rake #{name}[#{args.join(",")}]"
end