Module: Sequel::Metaprogramming
Overview
Contains meta_def method for adding methods to objects via blocks. Only recommended for backwards compatibility with existing code.
Instance Method Summary collapse
- 
  
    
      #meta_def(name, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Define a method with the given name and block body on the receiver. 
Instance Method Details
#meta_def(name, &block) ⇒ Object
Define a method with the given name and block body on the receiver.
ds = DB[:items]
ds.(:x){42}
ds.x # => 42
| 18 19 20 | # File 'lib/sequel/extensions/meta_def.rb', line 18 def (name, &block) (class << self; self end).send(:define_method, name, &block) end |