Sha256: 8f00583799dc3c5ef8314bf9b80b4aa9f84a4e84db33cb9133237f2d1e100fb8
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
module Udgenerator class Swift def parse(arrStr) result = {} arrStr.each{|s| if /\s*(\w+) *\* *(\w+)\s*;\s*/ =~ s then result[$2] = object($1) elsif /- \((\w+) *\* *\)(\w+);/ =~ s then result[$2] = object($1) elsif /\s*func\s+(\w+)\(\s*\)\s*->\s*(\w+)\s*\{?\s*/ =~ s then result[$1] = object($2) elsif /\s*(var|let)\s+(\w+)\s*:\s*(\w+)\??\s*;?\s*/ =~ s then result[$2] = object($3) end } result.delete("sharedManager") result.delete("defaults") result end def object(type) if "NSString" == type NSString.new() elsif "String" == type NSString.new() elsif "NSNumber" == type NSNumber.new() elsif "NSArray" == type NSArray.new() elsif "NSDictionary" == type NSDictionary.new() elsif "NSData" == type NSData.new() elsif "NSDate" == type NSDate.new() elsif "Bool" == type NSBOOL.new() elsif "Int" == type NSInteger.new() elsif "Double" == type NSDouble.new() elsif "Float" == type NSFloat.new() else AnyObject.new("#{type}") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
udgenerator-1.1.0 | lib/udgenerator/swift.rb |
udgenerator-1.0.6 | lib/udgenerator/swift.rb |
udgenerator-1.0.5 | lib/udgenerator/swift.rb |
udgenerator-1.0.4 | lib/udgenerator/swift.rb |