Class: PryDebug::LineBreakpoint
- Inherits:
-
Struct
- Object
- Struct
- PryDebug::LineBreakpoint
- Includes:
- ConditionalBreakpoint
- Defined in:
- lib/pry_debug/line_breakpoint.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#id ⇒ Object
Returns the value of attribute id.
-
#line ⇒ Object
Returns the value of attribute line.
Attributes included from ConditionalBreakpoint
Instance Method Summary collapse
- #at_location?(other_file, other_line) ⇒ Boolean
- #is_at?(other_file, other_line, binding) ⇒ Boolean
- #split_file(file) ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
2 3 4 |
# File 'lib/pry_debug/line_breakpoint.rb', line 2 def file @file end |
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/pry_debug/line_breakpoint.rb', line 2 def id @id end |
#line ⇒ Object
Returns the value of attribute line
2 3 4 |
# File 'lib/pry_debug/line_breakpoint.rb', line 2 def line @line end |
Instance Method Details
#at_location?(other_file, other_line) ⇒ Boolean
5 6 7 8 9 10 11 12 13 |
# File 'lib/pry_debug/line_breakpoint.rb', line 5 def at_location?(other_file, other_line) return false unless line == other_line path = "" split_file(other_file).any? do |part| path = File.join(part, path).chomp('/') path == file end end |
#is_at?(other_file, other_line, binding) ⇒ Boolean
15 16 17 |
# File 'lib/pry_debug/line_breakpoint.rb', line 15 def is_at?(other_file, other_line, binding) at_location?(other_file, other_line) && super(binding) end |
#split_file(file) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pry_debug/line_breakpoint.rb', line 19 def split_file(file) ary = [] loop do dirname, filename = File.split(file) ary << filename if dirname == '.' break elsif dirname == '/' ary << '/' break else file = dirname end end ary end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/pry_debug/line_breakpoint.rb', line 40 def to_s "breakpoint #{id} at #{file}:#{line}#{super}" end |