Sha256: 8bf9580d71190b4771e8b9d0c889537b856fe4b331975c81043260a248f801f3

Contents?: true

Size: 532 Bytes

Versions: 5

Compression:

Stored size: 532 Bytes

Contents

# encoding: utf-8

module RuboCop
  module Cop
    # Common functionality for checking if nodes.
    module IfNode
      def modifier_if?(node)
        node.loc.respond_to?(:end) && 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

5 entries across 5 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/mixin/if_node.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/mixin/if_node.rb
rubocop-0.26.1 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.26.0 lib/rubocop/cop/mixin/if_node.rb
rubocop-0.25.0 lib/rubocop/cop/mixin/if_node.rb