Class | Ohcount::Gestalt::JavaImportRule
In: | lib/gestalt/rules/java_import_rule.rb
Parent: | FileRule

Triggers if a c or cpp header is present

### Methods

new regexp trigger_file?

### Attributes

imports | [R] |

### Public Class methods

new(*args)

[Source]

    # File lib/gestalt/rules/java_import_rule.rb, line 7
                            def initialize(*args)
                                    options = args.pop if args.last.is_a?(Hash)
                                    @imports = args
                                    super(options)
                            end

### Public Instance methods

regexp()

[Source]

    # File lib/gestalt/rules/java_import_rule.rb, line 18
                            def regexp
                                    @regexp ||= begin
                                            imports_term = "(" + imports.join("|") + ")"
                                            Regexp.new("import\s+#{ imports_term }")
                                    end
                            end

trigger_file?(source_file)

[Source]

    # File lib/gestalt/rules/java_import_rule.rb, line 13
                            def trigger_file?(source_file)
                                    return false unless source_file.polyglot == 'java'
                                    regexp.match(source_file.language_breakdown('java').code)
                            end

[Validate]