Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/will_paginate/core_ext.rb

Overview

helper to check for method existance in ruby 1.8- and 1.9-compatible way because ‘methods`, `instance_methods` and others return strings in 1.8 and symbols in 1.9

['foo', 'bar'].include_method?(:foo) # => true

Direct Known Subclasses

WillPaginate::Collection

Instance Method Summary collapse

Instance Method Details

#include_method?(name) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/will_paginate/core_ext.rb', line 9

def include_method?(name)
  name = name.to_sym
  !!(find { |item| item.to_sym == name })
end