class SwiftGenerator::SwiftMethodBase

Attributes

access_control_modifiers[RW]
argStr[RW]
bodyLines[RW]
comment[RW]
func_qualifiers[RW]
indent[RW]
name[RW]
override[RW]
returns[RW]

Public Class Methods

new(swift_element, name, argStr, returns, override: false, comment: nil) click to toggle source
# 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

Public Instance Methods

<<(*line_or_lines) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# 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