Class: Binding

Inherits:
Object show all
Defined in:
lib/garcon/core_ext/binding.rb

Overview

Author: Stefano Harding <[email protected]> License: Apache License, Version 2.0 Copyright: © 2014-2015 Stefano Harding

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Method Summary collapse

Instance Method Details

#__callee__Object

Retreive the current running method.



53
54
55
# File 'lib/garcon/core_ext/binding.rb', line 53

def __callee__
  Kernel.eval("__callee__", self)
end

#__DIR__Object

Return the directory of the file in which the binding was created.



41
42
43
# File 'lib/garcon/core_ext/binding.rb', line 41

def __DIR__
  File.dirname(self.__FILE__)
end

#__FILE__Object

Returns file name in which the binding was created.



35
36
37
# File 'lib/garcon/core_ext/binding.rb', line 35

def __FILE__
  Kernel.eval("__FILE__", self)
end

#__LINE__Object

Return the line number on which the binding was created.



29
30
31
# File 'lib/garcon/core_ext/binding.rb', line 29

def __LINE__
  Kernel.eval("__LINE__", self)
end

#__method__Object

Retreive the current running method.



47
48
49
# File 'lib/garcon/core_ext/binding.rb', line 47

def __method__
  Kernel.eval("__method__", self)
end

#caller(skip = 0) ⇒ Object

Returns the call stack, same format as Kernel#caller()



23
24
25
# File 'lib/garcon/core_ext/binding.rb', line 23

def caller( skip=0 )
  eval("caller(#{skip})")
end

#callstack(level = 1) ⇒ Object Also known as: call_stack

Returns the call stack, in array format.



58
59
60
# File 'lib/garcon/core_ext/binding.rb', line 58

def callstack(level=1)
  eval( "callstack( #{level} )" )
end