Class: Snapdragon::Path
- Inherits:
-
Object
- Object
- Snapdragon::Path
- Defined in:
- lib/snapdragon/path.rb
Instance Attribute Summary collapse
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #absolute_path ⇒ Object
- #has_line_number? ⇒ Boolean
-
#initialize(raw_path) ⇒ Path
constructor
A new instance of Path.
- #spec_files ⇒ Object
Constructor Details
#initialize(raw_path) ⇒ Path
Returns a new instance of Path.
8 9 10 11 12 13 14 15 16 |
# File 'lib/snapdragon/path.rb', line 8 def initialize(raw_path) @raw_path = raw_path if has_line_number? @path, @line_number = raw_path.split(':') @line_number = @line_number.to_i else @path = raw_path end end |
Instance Attribute Details
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
6 7 8 |
# File 'lib/snapdragon/path.rb', line 6 def line_number @line_number end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/snapdragon/path.rb', line 6 def path @path end |
Instance Method Details
#absolute_path ⇒ Object
35 36 37 |
# File 'lib/snapdragon/path.rb', line 35 def absolute_path File.(@path) end |
#has_line_number? ⇒ Boolean
30 31 32 33 |
# File 'lib/snapdragon/path.rb', line 30 def has_line_number? return true if @raw_path =~ /^.*:\d+$/ return false end |
#spec_files ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/snapdragon/path.rb', line 18 def spec_files if exists? if is_a_directory? spec_dir = Snapdragon::SpecDirectory.new(self) return spec_dir.spec_files else return [Snapdragon::SpecFile.new(self)] end end return [] end |