Class: SwiftGenerator::SwiftMethodBase
- Inherits:
-
Object
- Object
- SwiftGenerator::SwiftMethodBase
- Defined in:
- lib/swift_generator/code_generation/swift_class_generation.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_control_modifiers ⇒ Object
Returns the value of attribute access_control_modifiers.
-
#argStr ⇒ Object
Returns the value of attribute argStr.
-
#bodyLines ⇒ Object
Returns the value of attribute bodyLines.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#func_qualifiers ⇒ Object
Returns the value of attribute func_qualifiers.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#name ⇒ Object
Returns the value of attribute name.
-
#override ⇒ Object
Returns the value of attribute override.
-
#returns ⇒ Object
Returns the value of attribute returns.
Instance Method Summary collapse
- #<<(*line_or_lines) ⇒ Object
- #_i(*line_or_lines) ⇒ Object
- #_o(*line_or_lines) ⇒ Object
- #func_fragment ⇒ Object
- #ii(*line_or_lines) ⇒ Object
-
#initialize(swift_element, name, argStr, returns, override: false, comment: nil) ⇒ SwiftMethodBase
constructor
A new instance of SwiftMethodBase.
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_modifiers ⇒ Object
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 |
#argStr ⇒ Object
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 |
#bodyLines ⇒ Object
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 |
#comment ⇒ Object
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_qualifiers ⇒ Object
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 |
#indent ⇒ Object
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 |
#name ⇒ Object
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 |
#override ⇒ Object
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 |
#returns ⇒ Object
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_fragment ⇒ Object
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 |