class String

Public Instance Methods

to_date() click to toggle source

Use NSDataDetector to parse a string containing a date or duration. These can be of the form:

“tomorrow at 7:30 PM” “11.23.2013” “from 7:30 to 10:00 AM”

etc.

# File lib/cocoa/sugarcube-nsdate/date_parser.rb, line 86
def to_date
  SugarCube::DateParser.parse_date(self)
end
to_duration() click to toggle source
# File lib/cocoa/sugarcube-nsdate/date_parser.rb, line 94
def to_duration
  SugarCube::DateParser.parse_duration(self)
end
to_timezone() click to toggle source
# File lib/cocoa/sugarcube-nsdate/date_parser.rb, line 90
def to_timezone
  SugarCube::DateParser.parse_time_zone(self)
end
|(filter) click to toggle source
# File lib/ios/sugarcube-pipes/pipes.rb, line 67
def |(filter)
  if Regexp === filter
    match = filter.match(self)
    match && match[0]
  elsif String === filter
    self.index(filter) && filter
  else
    raise "The `|` operator is not supported for the #{filter.is_a?(Class) ? filter.name : filter.class.to_s} class"
  end
end