Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/streams/activitystreams.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
49 50 51 |
# File 'lib/streams/activitystreams.rb', line 49 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
55 56 57 |
# File 'lib/streams/activitystreams.rb', line 55 def one_of_type? *args args.any? {|x| is_a? x} end |