Class: Rproof::LocatedInfo
- Inherits:
-
Object
- Object
- Rproof::LocatedInfo
- Defined in:
- lib/rproof/located_info.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
Instance Method Summary collapse
-
#initialize ⇒ LocatedInfo
constructor
A new instance of LocatedInfo.
Constructor Details
#initialize ⇒ LocatedInfo
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
#file ⇒ Object (readonly)
Returns the value of attribute file.
26 27 28 |
# File 'lib/rproof/located_info.rb', line 26 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
26 27 28 |
# File 'lib/rproof/located_info.rb', line 26 def line @line end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
26 27 28 |
# File 'lib/rproof/located_info.rb', line 26 def method @method end |
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
26 27 28 |
# File 'lib/rproof/located_info.rb', line 26 def pathname @pathname end |