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
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.22.5 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.22.4 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.22.3 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.22.2 lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.22.1 lib/active_support/core_ext/object/acts_like.rb
classiccms-0.7.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/object/acts_like.rb
classiccms-0.7.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/object/acts_like.rb
classiccms-0.7.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/object/acts_like.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.22 lib/active_support/core_ext/object/acts_like.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.12/lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.21 lib/active_support/core_ext/object/acts_like.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/object/acts_like.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/core_ext/object/acts_like.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/core_ext/object/acts_like.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/core_ext/object/acts_like.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/core_ext/object/acts_like.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/object/acts_like.rb
activesupport-3.2.20 lib/active_support/core_ext/object/acts_like.rb