Module: Mappum::DSL

Defined in:
lib/mappum/dsl.rb

Defined Under Namespace

Classes: Constant, Context, Field, FieldMap, Function, Map, Mappet, RootMap

Class Method Summary collapse

Class Method Details

.get_src_refObject



10
11
12
13
14
15
16
17
18
# File 'lib/mappum/dsl.rb', line 10

def  self.get_src_ref
   caller_arr = caller(2)
  file = nil
  begin
    caller_line = caller_arr.shift
    file = parse_caller(caller_line).first
  end while file == __FILE__ and not caller_arr.empty?
  return caller_line
end

.parse_caller(at) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/mappum/dsl.rb', line 19

def self.parse_caller(at)
  if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
    file = Regexp.last_match[1]
line = Regexp.last_match[2].to_i
method = Regexp.last_match[3]
[file, line, method]
end
end