Sha256: bb8a23842146013fcf38f8624f13de1cd6be00a0043fd6999af5b4c7b175963e
Contents?: true
Size: 1.01 KB
Versions: 8
Compression:
Stored size: 1.01 KB
Contents
module Udgenerator class Objective 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*(\w+)\s+(\w+)\s*;\s*/ =~ s then result[$2] = value($1) elsif /- \((\w+)\)(\w+);/ =~ s then result[$2] = value($1) end } result end def object(type) if "NSString" == 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() else AnyObject.new("#{type}") end end def value(type) if "NSInteger" == type then NSInteger.new() elsif "BOOL" == type then NSBOOL.new() elsif "float" == type then NSFloat.new() elsif "double" == type then NSDouble.new() else AnyObject.new("#{type}") end end end end
Version data entries
8 entries across 8 versions & 1 rubygems