Class: Deadlink::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/deadlink/path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cur_file_path, link, index, repo_root) ⇒ Path

Returns a new instance of Path.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/deadlink/path.rb', line 7

def initialize(cur_file_path, link, index, repo_root)
  @cur_file_path = cur_file_path
  @link = link
  @index = index
  @repo_root = repo_root
  
  hash = split_link(link)
  @anchor = hash[:anchor]
  @link_file_path = hash[:filepath]


  @abs_link_file_path = abs_link_file_path
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



5
6
7
# File 'lib/deadlink/path.rb', line 5

def anchor
  @anchor
end

#cur_file_pathObject (readonly)

Returns the value of attribute cur_file_path.



5
6
7
# File 'lib/deadlink/path.rb', line 5

def cur_file_path
  @cur_file_path
end

#indexObject (readonly)

Returns the value of attribute index.



5
6
7
# File 'lib/deadlink/path.rb', line 5

def index
  @index
end

Returns the value of attribute link.



5
6
7
# File 'lib/deadlink/path.rb', line 5

def link
  @link
end

Instance Method Details

#deadlink?(files) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/deadlink/path.rb', line 21

def deadlink?(files)
  (not_exist? || anchor_invalid?(files)) && not_ignore?
end