Method: NSDate#string_with_style

Defined in:
lib/sugarcube-nsdate/nsdate.rb

#string_with_style(date_style = NSDateFormatterMediumStyle, time_style = NSDateFormatterNoStyle) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/sugarcube-nsdate/nsdate.rb', line 37

def string_with_style(date_style=NSDateFormatterMediumStyle, time_style=NSDateFormatterNoStyle)
  date_formatter = NSDateFormatter.new
  date_style = date_style.nsdatestyle if date_style.is_a? Symbol
  time_style = time_style.nsdatestyle if time_style.is_a? Symbol
  date_formatter.setDateStyle(date_style)
  date_formatter.setTimeStyle(time_style)
  date_formatter.stringFromDate(self)
end