Class: Object

Inherits:
BasicObject
Defined in:
lib/streams/activitystreams.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


55
56
57
# File 'lib/streams/activitystreams.rb', line 55

def one_of_type? *args
  args.any? {|x| is_a? x}
end