Sha256: 3ab38db26a7ec090335efc463b1a427446767930ec39cbf08b446a9f0fec272e

Contents?: true

Size: 502 Bytes

Versions: 10

Compression:

Stored size: 502 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    # Common functionality for checking if nodes.
    module IfNode
      def modifier_if?(node)
        node.loc.end.nil?
      end

      def ternary_op?(node)
        node.loc.respond_to?(:question)
      end

      def elsif?(node)
        node.loc.respond_to?(:keyword) && node.loc.keyword &&
          node.loc.keyword.is?('elsif')
      end

      def if_else?(node)
        node.loc.respond_to?(:else) && node.loc.else
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubocop-0.22.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.21.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.20.1 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.20.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.19.1 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.19.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.18.1 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.18.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.17.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.16.0 lib/rubocop/cop/style/if_node.rb