Class: Rproof::LocatedInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rproof/located_info.rb

Direct Known Subclasses

Assertion, Warning

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLocatedInfo

Returns a new instance of LocatedInfo.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rproof/located_info.rb', line 9

def initialize
  @pathname = nil
  @file = nil
  @line = nil
  @method = nil
  caller.each do |line|
    matches = line.match /^.*\.rb/
    pathname = Pathname.new(matches[0])
    if not pathname.to_s.match(/lib\/(censor)|(assertion)|(warning)\.rb$/) and nil == @file # ignore lib files, until test definition file
      @pathname = pathname
      @file = pathname.basename
      matches = line.match /^.*\.rb:(\d*):in `([^']*)'/
      @line = matches[1]
      @method = matches[2]
    end
  end
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



26
27
28
# File 'lib/rproof/located_info.rb', line 26

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



26
27
28
# File 'lib/rproof/located_info.rb', line 26

def line
  @line
end

#methodObject (readonly)

Returns the value of attribute method.



26
27
28
# File 'lib/rproof/located_info.rb', line 26

def method
  @method
end

#pathnameObject (readonly)

Returns the value of attribute pathname.



26
27
28
# File 'lib/rproof/located_info.rb', line 26

def pathname
  @pathname
end