Permalink
Browse files

Fixed warnings, updated podspec name

  • Loading branch information...
zdavison committed Apr 17, 2013
1 parent e13e322 commit 335452cacf5c13be18f03d9ca4b2bde523f1684b
Showing with 14 additions and 5 deletions.
  1. BIN .DS_Store
  2. +1 −0 .gitignore
  3. +9 −1 NSString+Ruby/NSString+Ruby.m
  4. +1 −1 NSString+RubyTests/NSString+RubySpec.m
  5. +3 −3 NSString-Ruby.podspec
View
BIN .DS_Store
Binary file not shown.
View
@@ -2,3 +2,4 @@ Pods/
Build/
DerivedData/
*/xcuserdata/*
+.DS_Store
@@ -406,7 +406,15 @@ - (NSArray*)match:(NSString*)pattern offset:(int)offset{
NSArray *matches = [regex matchesInString:self options:0 range:NSMakeRange(offset, self.length-offset)];
for(NSTextCheckingResult *match in matches) {
- [results addObject:[self substringWithRange:match.range]];
+ //we want to honor capture groups, the obj-c way is.. -_-,
+ //skip the first match, it's most probably not correct
+ if(match.numberOfRanges > 1){
+ for(int i=1;i<match.numberOfRanges;i++){
+ [results addObject:[self substringWithRange:[match rangeAtIndex:i]]];
+ }
+ }else{
+ [results addObject:[self substringWithRange:match.range]];
+ }
}
return results;
}
@@ -43,7 +43,7 @@
a["lo"] #=> "lo"
a["bye"] #=> nil
*/
-describe(@"NSString []/{} accessors", ^{
+describe(@"NSString []/{} accessors / ranges", ^{
NSString *a = @"hello there";
it(@"a[1] #=> \"e\"", ^{
[[a[1] should] equal:@"e"];
View
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
- s.name = "NSString-Ruby"
- s.version = "1.0a"
+ s.name = "NSString+Ruby"
+ s.version = "1.0b"
s.summary = "NSString category providing common Ruby String methods."
s.homepage = "https://github.com/zdavison/NSString-Ruby"
s.license = 'MIT'
s.author = { "zdavison" => "zac.developer@gmail.com" }
- s.source = { :git => "https://github.com/zdavison/NSString-Ruby.git", :tag => "v1.0a" }
+ s.source = { :git => "https://github.com/zdavison/NSString-Ruby.git", :tag => "v1.0b" }
s.source_files = 'NSString+Ruby/NSString+Ruby.{h,m}'
s.public_header_files = 'NSString+Ruby/NSString+Ruby.h'
s.requires_arc = true

0 comments on commit 335452c

Please sign in to comment.