class Objc2swiftAssistant::PropertyDeclarationRegion
Attributes
block_args[RW]
block_return_type[RW]
is_block_property[RW]
is_pointer[RW]
modifiers[RW]
name[RW]
type_name[RW]
Public Class Methods
new(starting_line_number, is_root_entity )
click to toggle source
Calls superclass method
Objc2swiftAssistant::MigrationRegion::new
# File lib/objc2swift_assistant/recognizers/property_declaration_recognizer.rb, line 24 def initialize(starting_line_number, is_root_entity ) super(starting_line_number, is_root_entity, PROPERTY_DECLARATION_KEY ) end
Public Instance Methods
brief_description()
click to toggle source
# File lib/objc2swift_assistant/recognizers/property_declaration_recognizer.rb, line 72 def brief_description return "(#{@modifiers.join( ', ' )}) #{@type_name} #{'*' if @is_pointer} #{@name}" end
description()
click to toggle source
# File lib/objc2swift_assistant/recognizers/property_declaration_recognizer.rb, line 64 def description() if @is_block_property return generic_description( "Block Property: prop_name=#{@prop_name} block_return_type=#{@block_return_type} block_args=#{@block_args}" ) else return generic_description( "type_name=#{@type_name} is_pointer=#{@is_pointer} prop_name=#{@prop_name}" ) end end
extract_information( file_slice )
click to toggle source
# File lib/objc2swift_assistant/recognizers/property_declaration_recognizer.rb, line 28 def extract_information( file_slice ) m = /^\s*(@property)\s*\((?<modifiers>.*)\)\s*(?<type>\w*)\s*(?<pointer>\*?)\s*(?<prop_name>\w*)/.match(file_slice[0]) unless m.nil? @type_name = m["type"] @is_pointer = m["pointer"] == '*' @name = m["prop_name"] #TODO: @modifiers = capture_modifiers( m["modifiers"] ) @modifiers = split_modifiers( m["modifiers"] ) if @type_name.nil? || @type_name.length == 0 # Test for Block declaration m = /^\s*(@property)\s*\((?<modifiers>.*)\)\s*(?<return_type>\w*)\s*\(\^(?<name>\w*)\)\s*\((?<args>.*)\)/.match(file_slice[0]) unless m.nil? @is_block_property = true @block_return_type = m[ 'return_type' ] @name = m[ 'name' ] @block_args = m[ 'args' ] # TODO: Split these @configuration.log_verbose( "Matched: " + description ) else @configuration.log_warning( "Could not match block property declaraion in #{file_slice[0]}" ) end else @configuration.log_verbose( description ) end else @configuration.log_warning( "Could not match property declaraion in #{file_slice[0]}" ) end end
split_modifiers( modifiers )
click to toggle source
# File lib/objc2swift_assistant/recognizers/property_declaration_recognizer.rb, line 59 def split_modifiers( modifiers ) return if modifiers.nil? @modifiers = modifiers.strip.split( /\s*,\s*/ ) end