Class: Sequel::BasicObject
- Inherits:
- BasicObject
- Defined in:
- lib/sequel/sql.rb,
lib/sequel/sql.rb
Overview
If on 1.9, create a Sequel::BasicObject class that is just like the default BasicObject class, except that missing constants are resolved in Object. This allows the virtual row support to work with classes without prefixing them with ::, such as:
DB[:bonds].filter{maturity_date > Time.now}
Direct Known Subclasses
MigrationDSL, Plugins::AssociationProxies::AssociationProxy, SQL::VirtualRow
Constant Summary collapse
- KEEP_METHODS =
The instance methods to not remove from the class when removing other methods.
%w"__id__ __send__ __metaclass__ instance_eval == equal? initialize"
Class Method Summary collapse
-
.const_missing(name) ⇒ Object
Lookup missing constants in ::Object.
-
.remove_methods! ⇒ Object
No-op method on ruby 1.9, which has a real BasicObject class.
Class Method Details
.const_missing(name) ⇒ Object
Lookup missing constants in ::Object
28 29 30 |
# File 'lib/sequel/sql.rb', line 28 def self.const_missing(name) ::Object.const_get(name) end |
.remove_methods! ⇒ Object
No-op method on ruby 1.9, which has a real BasicObject class.
14 15 16 |
# File 'lib/sequel/sql.rb', line 14 def self.remove_methods! ((private_instance_methods + instance_methods) - KEEP_METHODS).each{|m| undef_method(m)} end |