Class: Object

Inherits:
BasicObject
Defined in:
lib/roxml/extensions/string.rb,
lib/roxml/extensions/active_support.rb,
lib/roxml/extensions/string/conversions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#to_latinObject

Deprecated in favor of explicit #to_s.to_latin



17
18
19
20
# File 'lib/roxml/extensions/string.rb', line 17

def to_latin
  ActiveSupport::Deprecation.warn "This method will be removed from Object please use String#to_latin instead via explicit #to_s"
  to_s.to_latin
end

#to_utfObject

Deprecated in favor of explicit #to_s.to_utf



11
12
13
14
# File 'lib/roxml/extensions/string.rb', line 11

def to_utf
  ActiveSupport::Deprecation.warn "This method will be removed from Object please use String#to_utf instead via explicit #to_s"
  to_s.to_utf
end

#try(method, *args, &block) ⇒ Object

Taken from the upcoming ActiveSupport 2.3

Tries to send the method only if object responds to it. Return nil otherwise. It will also forward any arguments and/or block like Object#send does.

Example :

# Without try With try @person.try(:name)

# try also accepts arguments/blocks for the method it is trying Person.try(:find, 1) @people.try(:map) {|p| p.name}



50
51
52
# File 'lib/roxml/extensions/active_support.rb', line 50

def try(method, *args, &block)
  send(method, *args, &block) if respond_to?(method, true)
end