Class: Jaspion::Kilza::Swift::Class
- Inherits:
-
Object
- Object
- Jaspion::Kilza::Swift::Class
- Includes:
- Class
- Defined in:
- lib/jaspion/kilza/language/swift/class.rb
Instance Attribute Summary
Attributes included from Class
Instance Method Summary collapse
-
#initialize(name) ⇒ Class
constructor
A new instance of Class.
- #push(pr) ⇒ Object
- #sources ⇒ Object
Methods included from Class
#code, #delete_import, #imports, #push_import, #to_s
Constructor Details
#initialize(name) ⇒ Class
Returns a new instance of Class.
7 8 9 10 |
# File 'lib/jaspion/kilza/language/swift/class.rb', line 7 def initialize(name) name = name + RESERVED_CLASS_POSFIX unless RESERVED_WORDS.index(name.downcase).nil? super(name) end |
Instance Method Details
#push(pr) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jaspion/kilza/language/swift/class.rb', line 12 def push(pr) if pr.object? || (pr.array? && pr.null?) pr.type = pr.class_name push_import("import #{pr.class_name}") end pr.type = Jaspion::Kilza::Swift::TYPES[pr.type] unless Jaspion::Kilza::Swift::TYPES[pr.type].nil? pr.type = "[#{pr.type}]" if pr.array? super(pr) end |
#sources ⇒ Object
24 25 26 |
# File 'lib/jaspion/kilza/language/swift/class.rb', line 24 def sources [code('swift', 'swift')] end |