Class: Object

Inherits:
BasicObject
Defined in:
lib/util.rb,
lib/metaid.rb

Instance Method Summary collapse

Instance Method Details

#args_and_options(*args) ⇒ Object



2
3
4
5
# File 'lib/util.rb', line 2

def args_and_options(*args)
  options = Hash === args.last ? args.pop : {}
  return args, options
end

#class_def(name, &blk) ⇒ Object

Defines an instance method within a class



14
15
16
# File 'lib/metaid.rb', line 14

def class_def name, &blk
  class_eval { define_method name, &blk }
end

#meta_def(name, &blk) ⇒ Object

Adds methods to a metaclass



9
10
11
# File 'lib/metaid.rb', line 9

def meta_def name, &blk
  meta_eval { define_method name, &blk }
end

#meta_eval(*args, &blk) ⇒ Object



5
# File 'lib/metaid.rb', line 5

def meta_eval(*args, &blk); metaclass.instance_eval(*args, &blk); end

#metaclassObject

The hidden singleton lurks behind everyone



3
# File 'lib/metaid.rb', line 3

def metaclass; class << self; self; end; end