Class | Ohcount::Gestalt::KeywordRule
In: | lib/gestalt/rules/keyword_rule.rb
Parent: | FileRule

### Methods

new regexp trigger_file?

### Attributes

keywords | [R] |
language | [R] |

### Public Class methods

new(language, *args)

[Source]

    # File lib/gestalt/rules/keyword_rule.rb, line 6
                            def initialize(language, *args)
                                    options = args.pop if args.last.is_a?(Hash)
                                    keywords = args
                                    @language = language
                                    @keywords = keywords
                                    super(options)
                            end

### Public Instance methods

regexp()

[Source]

    # File lib/gestalt/rules/keyword_rule.rb, line 19
                            def regexp
                                    @regexp ||= begin
                                            Regexp.new("(" + keywords.join("|") + ")")
                                    end
                            end

trigger_file?(source_file)

[Source]

    # File lib/gestalt/rules/keyword_rule.rb, line 14
                            def trigger_file?(source_file)
                                    return unless source_file.language_breakdown(language)
                                    regexp.match(source_file.language_breakdown(language).code)
                            end

[Validate]