Class: AnnotateRb::ModelAnnotator::PatternGetter
- Inherits:
-
Object
- Object
- AnnotateRb::ModelAnnotator::PatternGetter
- Defined in:
- lib/annotate_rb/model_annotator/pattern_getter.rb
Defined Under Namespace
Modules: FilePatterns
Class Method Summary collapse
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(options, pattern_types = []) ⇒ PatternGetter
constructor
A new instance of PatternGetter.
Constructor Details
#initialize(options, pattern_types = []) ⇒ PatternGetter
Returns a new instance of PatternGetter.
59 60 61 62 |
# File 'lib/annotate_rb/model_annotator/pattern_getter.rb', line 59 def initialize(, pattern_types = []) @options = @pattern_types = pattern_types end |
Class Method Details
.call(options, pattern_types = []) ⇒ Object
54 55 56 |
# File 'lib/annotate_rb/model_annotator/pattern_getter.rb', line 54 def call(, pattern_types = []) new(, pattern_types).get end |
Instance Method Details
#get ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/annotate_rb/model_annotator/pattern_getter.rb', line 64 def get current_patterns = [] @options[:root_dir].each do |root_directory| Array(@pattern_types).each do |pattern_type| patterns = generate(root_directory, pattern_type) current_patterns += if pattern_type.to_sym == :additional_file_patterns patterns else patterns.map { |p| p.sub(/^\/*/, "") } end end end current_patterns end |