Class: Objc2swiftAssistant::ProtocolRegion
- Inherits:
 - 
      MigrationRegion
      
        
- Object
 - FailableProcessingElement
 - MigrationRegion
 - Objc2swiftAssistant::ProtocolRegion
 
 
- Defined in:
 - lib/objc2swift_assistant/recognizers/protocol_recognizer.rb
 
Instance Attribute Summary collapse
- 
  
    
      #extends  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute extends.
 - 
  
    
      #protocol_name  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute protocol_name.
 
Attributes inherited from MigrationRegion
#allowed_parent_region_types, #can_occur_in_class_decl, #configuration, #detection_line, #ending_line_number, #ending_of_root_header, #is_root_entity, #is_single_line, #parent_region, #region_identifier, #region_type, #root_header, #starting_line_number, #sub_regions
Attributes inherited from FailableProcessingElement
Instance Method Summary collapse
- #description ⇒ Object
 - #extract_information(file_slice) ⇒ Object
 - 
  
    
      #initialize(starting_line_number, is_root_entity)  ⇒ ProtocolRegion 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ProtocolRegion.
 
Methods inherited from MigrationRegion
#add_sub_region, #brief_description, #complete, #contains_line, #dump, #dump_region_info, #generic_description, #has_failed, #resolve_ending_line_number
Methods inherited from FailableProcessingElement
#add_error, #add_warning, #has_errors, #initiailize
Constructor Details
#initialize(starting_line_number, is_root_entity) ⇒ ProtocolRegion
Returns a new instance of ProtocolRegion.
      18 19 20  | 
    
      # File 'lib/objc2swift_assistant/recognizers/protocol_recognizer.rb', line 18 def initialize(starting_line_number, is_root_entity ) super(starting_line_number, is_root_entity, PROTOCOL_DECLARATION_KEY ) end  | 
  
Instance Attribute Details
#extends ⇒ Object
Returns the value of attribute extends.
      16 17 18  | 
    
      # File 'lib/objc2swift_assistant/recognizers/protocol_recognizer.rb', line 16 def extends @extends end  | 
  
#protocol_name ⇒ Object
Returns the value of attribute protocol_name.
      15 16 17  | 
    
      # File 'lib/objc2swift_assistant/recognizers/protocol_recognizer.rb', line 15 def protocol_name @protocol_name end  | 
  
Instance Method Details
#description ⇒ Object
      34 35 36  | 
    
      # File 'lib/objc2swift_assistant/recognizers/protocol_recognizer.rb', line 34 def description() generic_description( "Protocol: #{@protocol_name}" ) end  | 
  
#extract_information(file_slice) ⇒ Object
      22 23 24 25 26 27 28 29 30 31 32  | 
    
      # File 'lib/objc2swift_assistant/recognizers/protocol_recognizer.rb', line 22 def extract_information( file_slice ) m = /^\s*(@protocol)\s+(?<protocol_name>\w*)\s*(<(?<extends>.*)>)?/.match(file_slice[0]) unless m.nil? @protocol_name = m["protocol_name"] extends_list = m["extends"] @extends = extends.nil? ? [] : extends_list.split( /\s*,\s*/ ) @configuration.log_verbose( "class_name = #{@protocol_name} extends = #{@extends}") else @configuration.log_warning( "Could not match protocol declaration in #{file_slice[0]}" ) end end  |