Sha256: c42a350319f97f494ea3c1e7b199a94df1d44e9463fc7c4e5ca5c165183b5c0e

Contents?: true

Size: 454 Bytes

Versions: 325

Compression:

Stored size: 454 Bytes

Contents

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

Version data entries

325 entries across 281 versions & 29 rubygems

Version Path
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/object/acts_like.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/core_ext/object/acts_like.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/object/acts_like.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/core_ext/object/acts_like.rb
challah-1.0.0.beta3 vendor/bundle/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
challah-1.0.0.beta2 vendor/bundle/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
challah-1.0.0.beta vendor/bundle/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
challah-1.0.0.beta vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/acts_like.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.13 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.1.12 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.13.rc2 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.13.rc1 lib/active_support/core_ext/object/acts_like.rb