Module: ActiveSupport::CoreExtensions::String::Conversions
- Included in:
- String
- Defined in:
- lib/active_support/core_ext/string/conversions.rb
Overview
Converting strings to other objects
Instance Method Summary collapse
-
#ord ⇒ Object
‘a’.ord == ‘a’ for Ruby 1.9 forward compatibility.
- #to_date ⇒ Object
- #to_datetime ⇒ Object
-
#to_time(form = :utc) ⇒ Object
Form can be either :utc (default) or :local.
Instance Method Details
#ord ⇒ Object
‘a’.ord == ‘a’ for Ruby 1.9 forward compatibility.
9 10 11 |
# File 'lib/active_support/core_ext/string/conversions.rb', line 9 def ord self[0] end |
#to_date ⇒ Object
18 19 20 |
# File 'lib/active_support/core_ext/string/conversions.rb', line 18 def to_date ::Date.new(*ParseDate.parsedate(self)[0..2]) end |