class Snapdragon::Path

Attributes

line_number[R]
path[R]

Public Class Methods

new(raw_path) click to toggle source
# 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

Public Instance Methods

absolute_path() click to toggle source
# File lib/snapdragon/path.rb, line 35
def absolute_path
  File.expand_path(@path)
end
has_line_number?() click to toggle source
# File lib/snapdragon/path.rb, line 30
def has_line_number?
  return true if @raw_path =~ /^.*:\d+$/
  return false
end
spec_files() click to toggle source
# 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

Private Instance Methods

exists?() click to toggle source
# File lib/snapdragon/path.rb, line 45
def exists?
  return ::File.exists?(@path)
end
is_a_directory?() click to toggle source
# File lib/snapdragon/path.rb, line 41
def is_a_directory?
  return ::File.directory?(@path)
end