Class: SwiftGenerator::SwiftMethodBase

Inherits:
Object
  • Object
show all
Defined in:
lib/swift_generator/code_generation/swift_class_generation.rb

Direct Known Subclasses

SwiftInitializer, SwiftMethod

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(swift_element, name, argStr, returns, override: false, comment: nil) ⇒ SwiftMethodBase

Returns a new instance of SwiftMethodBase.



1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1359

def initialize (swift_element, name, argStr, returns, override: false, comment: nil)
	@name = name
	@argStr = argStr
	@returns = returns
	@override = override
	@comment = comment

	@indent = 0
	@bodyLines = []

	@access_control_modifiers = []
end

Instance Attribute Details

#access_control_modifiersObject

Returns the value of attribute access_control_modifiers.



1352
1353
1354
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1352

def access_control_modifiers
  @access_control_modifiers
end

#argStrObject

Returns the value of attribute argStr.



1347
1348
1349
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1347

def argStr
  @argStr
end

#bodyLinesObject

Returns the value of attribute bodyLines.



1356
1357
1358
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1356

def bodyLines
  @bodyLines
end

#commentObject

Returns the value of attribute comment.



1350
1351
1352
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1350

def comment
  @comment
end

#func_qualifiersObject

Returns the value of attribute func_qualifiers.



1353
1354
1355
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1353

def func_qualifiers
  @func_qualifiers
end

#indentObject

Returns the value of attribute indent.



1355
1356
1357
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1355

def indent
  @indent
end

#nameObject

Returns the value of attribute name.



1346
1347
1348
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1346

def name
  @name
end

#overrideObject

Returns the value of attribute override.



1348
1349
1350
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1348

def override
  @override
end

#returnsObject

Returns the value of attribute returns.



1349
1350
1351
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1349

def returns
  @returns
end

Instance Method Details

#<<(*line_or_lines) ⇒ Object



1373
1374
1375
1376
1377
1378
1379
1380
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1373

def << (*line_or_lines)
	line_or_lines = line_or_lines.flatten()
	line_or_lines.each do |line|
		new_line = ("\t" * @indent) + line
		@bodyLines << new_line
	end
	@bodyLines = @bodyLines.flatten()
end

#_i(*line_or_lines) ⇒ Object



1382
1383
1384
1385
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1382

def _i (*line_or_lines)
	@indent += 1
	self << line_or_lines
end

#_o(*line_or_lines) ⇒ Object



1387
1388
1389
1390
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1387

def _o (*line_or_lines)
	self << line_or_lines
	@indent -= 1
end

#func_fragmentObject



1398
1399
1400
1401
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1398

def func_fragment()
	return 'func' if func_qualifiers.nil?
	return [*func_qualifiers].join( ' ' ) + ' func'
end

#ii(*line_or_lines) ⇒ Object



1392
1393
1394
1395
1396
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 1392

def ii (*line_or_lines)
	@indent += 1
	self << line_or_lines
	@indent -= 1
end