aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/basic_object.rb
blob: bb01a47508622b810765027ec2014e223c776cb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Ruby 1.9 introduces BasicObject which differs slighly from Builder's BlankSlate
# that had been used so far ActiveSupport::BasicObject provides a barebones object with
# the same method on both versions.
module ActiveSupport
  if RUBY_VERSION >= '1.9'
    class BasicObject < ::BasicObject
      undef_method :==
      undef_method :equal?

      # Let ActiveSupport::BasicObject at least raise exceptions.
      def raise(*args)
        ::Object.send(:raise, *args)
      end
    end
  else
    require 'blankslate'
    BasicObject = BlankSlate
  end
end