Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/wfjrd/wfjrd.rb
Instance Method Summary collapse
-
#method?(sym) ⇒ Boolean
Tests whether the method exists.
-
#one_of_type?(*args) ⇒ Boolean
Tests to see if the Object is one of several possible types like is_a? but accepting multiple arguments.
Instance Method Details
#method?(sym) ⇒ Boolean
Tests whether the method exists. Unlike the std method, however, does not throw a NameError if it doesn’t. Just returns false
58 59 60 |
# File 'lib/wfjrd/wfjrd.rb', line 58 def method? sym method sym rescue false end |
#one_of_type?(*args) ⇒ Boolean
Tests to see if the Object is one of several possible types like is_a? but accepting multiple arguments
64 65 66 |
# File 'lib/wfjrd/wfjrd.rb', line 64 def one_of_type? *args args.any? {|x| is_a? x} end |