Class: Object

Class | Object
In: | lib/sequel_core/core_ext.rb
Parent: | Object

Helpers from Metaid and a bit more

### Methods

blank? is_one_of? meta_def meta_eval metaclass

### Public Instance methods

blank?()

Objects are blank if they respond true to empty?

[Source]

         # File lib/sequel_core/core_ext.rb, line 108
    108:   def blank?
    109:     respond_to?(:empty?) && empty?
    110:   end

is_one_of?(*classes)

Returns true if the object is an instance of one of the classes

[Source]

         # File lib/sequel_core/core_ext.rb, line 113
    113:   def is_one_of?(*classes)
    114:     !!classes.find{|c| is_a?(c)}
    115:   end

meta_def(name, &block)

Add methods to the object‘s metaclass

[Source]

         # File lib/sequel_core/core_ext.rb, line 118
    118:   def meta_def(name, &block)
    119:     meta_eval{define_method(name, &block)}
    120:   end

meta_eval(&block)

Evaluate the block in the context of the object‘s metaclass

[Source]

         # File lib/sequel_core/core_ext.rb, line 123
    123:   def meta_eval(&block)
    124:     metaclass.instance_eval(&block)
    125:   end

metaclass()

The hidden singleton lurks behind everyone

[Source]

         # File lib/sequel_core/core_ext.rb, line 128
    128:   def metaclass
    129:     class << self
    130:       self
    131:     end
    132:   end

[Validate]