Module: RuboCop::Cop::Rake::Helper::TaskName
Instance Method Summary collapse
Instance Method Details
#task_name(node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rubocop/cop/rake/helper/task_name.rb', line 10 def task_name(node) first_arg = node.arguments[0] case first_arg&.type when :sym, :str first_arg.value.to_sym when :hash return nil if first_arg.children.size != 1 pair = first_arg.children.first key = pair.children.first case key.type when :sym, :str key.value.to_sym end end end |