Class: Betterp::Source
- Inherits:
-
Object
- Object
- Betterp::Source
- Defined in:
- lib/betterp/source.rb
Instance Method Summary collapse
-
#initialize(source, base_path) ⇒ Source
constructor
A new instance of Source.
- #line_no ⇒ Object
- #method_name ⇒ Object
- #path ⇒ Object
Constructor Details
#initialize(source, base_path) ⇒ Source
Returns a new instance of Source.
5 6 7 8 9 |
# File 'lib/betterp/source.rb', line 5 def initialize(source, base_path) @source = source @base_path = base_path @path, @line_no, @method_info = source.split(':') end |
Instance Method Details
#line_no ⇒ Object
17 18 19 |
# File 'lib/betterp/source.rb', line 17 def line_no @line_no.to_i end |
#method_name ⇒ Object
21 22 23 |
# File 'lib/betterp/source.rb', line 21 def method_name @method_info.partition('`').last.chomp("'") end |
#path ⇒ Object
11 12 13 14 15 |
# File 'lib/betterp/source.rb', line 11 def path Pathname.new(@path).relative_path_from(Pathname.new(@base_path)).to_s rescue ArgumentError @path end |