class RuboCop::Cop::Style::ColonMethodCall
- This cop checks for methods invoked via the
-
operator instead
of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
@example
# bad Timeout::timeout(500) { do_something } FileUtils::rmdir(dir) Marshal::dump(obj) # good Timeout.timeout(500) { do_something } FileUtils.rmdir(dir) Marshal.dump(obj)
Constants
- MSG
Public Class Methods
autocorrect_incompatible_with()
click to toggle source
# File lib/rubocop/cop/style/colon_method_call.rb, line 28 def self.autocorrect_incompatible_with [RedundantSelf] end
Public Instance Methods
autocorrect(node)
click to toggle source
# File lib/rubocop/cop/style/colon_method_call.rb, line 42 def autocorrect(node) ->(corrector) { corrector.replace(node.loc.dot, '.') } end
on_send(node)
click to toggle source
# File lib/rubocop/cop/style/colon_method_call.rb, line 32 def on_send(node) # ignore Java interop code like Java::int return if java_type_node?(node) return unless node.receiver && node.double_colon? return if node.camel_case_method? add_offense(node, location: :dot) end