Sha256: 4c0caf0e46ca209f12541ba22315c12e72cf40adb0f929a2f42b6b1be7f3f8c1

Contents?: true

Size: 495 Bytes

Versions: 237

Compression:

Stored size: 495 Bytes

Contents

class Object
  # A duck-type assistant method. For example, Active Support extends Date
  # to define an <tt>acts_like_date?</tt> method, and extends Time to define
  # <tt>acts_like_time?</tt>. As a result, we can do <tt>x.acts_like?(:time)</tt> and
  # <tt>x.acts_like?(:date)</tt> to do duck-type-safe comparisons, since classes that
  # we want to act like Time simply need to define an <tt>acts_like_time?</tt> method.
  def acts_like?(duck)
    respond_to? :"acts_like_#{duck}?"
  end
end

Version data entries

237 entries across 228 versions & 23 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.7.1/lib/active_support/core_ext/object/acts_like.rb
activesupport-4.2.11.3 lib/active_support/core_ext/object/acts_like.rb
activesupport-4.2.11.2 lib/active_support/core_ext/object/acts_like.rb
motion-support-1.2.1 motion/core_ext/object/acts_like.rb
motion-support-1.1.1 motion/core_ext/object/acts_like.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object/acts_like.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object/acts_like.rb
activesupport-5.1.7 lib/active_support/core_ext/object/acts_like.rb
activesupport-5.1.7.rc1 lib/active_support/core_ext/object/acts_like.rb
activesupport-5.1.6.2 lib/active_support/core_ext/object/acts_like.rb
activesupport-5.0.7.2 lib/active_support/core_ext/object/acts_like.rb
activesupport-4.2.11.1 lib/active_support/core_ext/object/acts_like.rb
activesupport-5.1.6.1 lib/active_support/core_ext/object/acts_like.rb
activesupport-5.0.7.1 lib/active_support/core_ext/object/acts_like.rb
activesupport-4.2.11 lib/active_support/core_ext/object/acts_like.rb
motion-support-1.2.0 motion/core_ext/object/acts_like.rb
activesupport-5.1.6 lib/active_support/core_ext/object/acts_like.rb
activesupport-5.0.7 lib/active_support/core_ext/object/acts_like.rb
tdiary-5.0.8 vendor/bundle/gems/activesupport-5.1.5/lib/active_support/core_ext/object/acts_like.rb
activesupport-5.1.5 lib/active_support/core_ext/object/acts_like.rb