class Objc2swiftAssistant::CodeRecognizer
Attributes
configuration[RW]
for_root_entities[RW]
match_region_class[RW]
source_file_type[RW]
start_match_regex[RW]
voiding_match[RW]
Public Class Methods
new( start_test_regex, match_region_class, source_file_type, for_root_entities, include_preceeding_comment=for_root_entities, voiding_regex: nil)
click to toggle source
# File lib/objc2swift_assistant/code_recognizer.rb, line 47 def initialize( start_test_regex, match_region_class, source_file_type, for_root_entities, include_preceeding_comment=for_root_entities, voiding_regex: nil) @start_line_match_regex = start_test_regex @match_region_class = match_region_class @source_file_type = source_file_type @for_root_entities = for_root_entities @voiding_regex = voiding_regex end
Public Instance Methods
matches( raw_file_lines )
click to toggle source
# File lib/objc2swift_assistant/code_recognizer.rb, line 55 def matches( raw_file_lines ) file_lines = Objc2swiftAssistant::de_comment_lines( raw_file_lines ) matched_regions = [] file_lines.each_with_index do |line, index| if @start_line_match_regex =~ line unless @voiding_regex.nil? if @voiding_regex =~ line break end end #print( line ) matched_region = @match_region_class.new( index, @for_root_entities ) matched_region.detection_line = line matched_region.configuration = @configuration matched_regions << matched_region end end @configuration.log_verbose( "" ) if matched_regions.length > 0 matched_regions.each do |region| # if region.region_type == 'at_directive' @configuration.log_verbose( "#{region.region_type} #{region.detection_line}" ) # end end return matched_regions end
should_scan_file( file_type )
click to toggle source
# File lib/objc2swift_assistant/code_recognizer.rb, line 86 def should_scan_file( file_type ) return true # if @source_file_type == :all_source_files # return [:header_file, :implementation_file].include?( file_type ) # else # file_type == @source_file_type # end end