Class: Object

Inherits:
BasicObject
Defined in:
lib/adhearsion/foundation/thread_safety.rb,
lib/adhearsion/voip/dsl/numerical_string.rb,
lib/adhearsion/foundation/metaprogramming.rb

Instance Method Summary collapse

Instance Method Details

#===(arg) ⇒ Object



90
91
92
93
94
95
96
97
# File 'lib/adhearsion/voip/dsl/numerical_string.rb', line 90

def ===(arg)
  if arg.respond_to? :__real_string
    arg = arg.__real_num if kind_of?(Numeric) || kind_of?(Range)
    pre_modified_threequal arg
  else
    pre_modified_threequal arg
  end
end

#meta_def(name, &block) ⇒ Object



12
13
14
15
16
# File 'lib/adhearsion/foundation/metaprogramming.rb', line 12

def meta_def(name, &block)
  meta_eval do
    define_method name, &block
  end
end

#meta_eval(&block) ⇒ Object



8
9
10
# File 'lib/adhearsion/foundation/metaprogramming.rb', line 8

def meta_eval(&block)
  metaclass.instance_eval &block
end

#metaclassObject



2
3
4
5
6
# File 'lib/adhearsion/foundation/metaprogramming.rb', line 2

def metaclass
  class << self
    self
  end
end

#synchronize(&block) ⇒ Object



3
4
5
6
# File 'lib/adhearsion/foundation/thread_safety.rb', line 3

def synchronize(&block)
  @mutex ||= Mutex.new
  @mutex.synchronize &block
end