Class: Dire::Link

Inherits:
Node
  • Object
show all
Defined in:
lib/dire/link.rb

Instance Attribute Summary

Attributes inherited from Node

#path, #root

Instance Method Summary collapse

Methods inherited from Node

#get, #initialize, #parent, #to_s, #type

Constructor Details

This class inherits a constructor from Dire::Node

Instance Method Details

#broken?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/dire/link.rb', line 3

def broken?
  !link.exist? || !inside?(link)
end

#paramObject



7
8
9
# File 'lib/dire/link.rb', line 7

def param
  chop(link).to_s
end

#validate!Object



11
12
13
14
15
16
17
18
19
# File 'lib/dire/link.rb', line 11

def validate!
  super && validate_type!('link')

  if broken?
    raise Dire::Error::InvalidLink, 'Dead link'
  end

  true
end