Sha256: e9cfab91a0d66245caec45d946822af9b822712a66d60a27bb3393ea8d138fb0

Contents?: true

Size: 540 Bytes

Versions: 8

Compression:

Stored size: 540 Bytes

Contents

module Sequel
  # Contains methods that ease metaprogramming, used by some of Sequel's classes.
  module Metaprogramming
    # Add methods to the object's metaclass
    def meta_def(name, &block)
      meta_eval{define_method(name, &block)}
    end 
  
    private
  
    # Evaluate the block in the context of the object's metaclass
    def meta_eval(&block)
      metaclass.instance_eval(&block)
    end 
  
    # The hidden singleton lurks behind everyone
    def metaclass
      class << self
        self
      end 
    end 
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sequel-3.7.0 lib/sequel/metaprogramming.rb
sequel-3.6.0 lib/sequel/metaprogramming.rb
sequel-3.5.0 lib/sequel/metaprogramming.rb
sequel-3.4.0 lib/sequel/metaprogramming.rb
sequel-3.2.0 lib/sequel/metaprogramming.rb
sequel-3.3.0 lib/sequel/metaprogramming.rb
sequel-3.1.0 lib/sequel/metaprogramming.rb
sequel-3.0.0 lib/sequel/metaprogramming.rb