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
Dataset::Query, MigrationAlterTableReverser, MigrationDSL, MigrationReverser, 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 instance_exec == equal? initialize method_missing"
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
32 33 34 |
# File 'lib/sequel/sql.rb', line 32 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.
17 18 19 |
# File 'lib/sequel/sql.rb', line 17 def self.remove_methods! ((private_instance_methods + instance_methods) - KEEP_METHODS).each{|m| undef_method(m)} end |