Class: SiteChecker::Link

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#kindObject

Returns the value of attribute kind.



6
7
8
# File 'lib/site_checker/link.rb', line 6

def kind
  @kind
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#modified_urlObject

Returns the value of attribute modified_url.



4
5
6
# File 'lib/site_checker/link.rb', line 4

def modified_url
  @modified_url
end

#parent_urlObject

Returns the value of attribute parent_url.



5
6
7
# File 'lib/site_checker/link.rb', line 5

def parent_url
  @parent_url
end

#problemObject

Returns the value of attribute problem.



8
9
10
# File 'lib/site_checker/link.rb', line 8

def problem
  @problem
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.create(attrs) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/site_checker/link.rb', line 22

def self.create(attrs)
  link = Link.new
  attrs.each do |key, value|
    if self.instance_methods.map{|m| m.to_s}.include?("#{key}=")
      eval("link.#{key}=value")
    end
  end
  link
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/site_checker/link.rb', line 14

def ==(other)
  eql?(other)
end

#anchor?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/site_checker/link.rb', line 54

def anchor?
  @kind == :anchor
end

#anchor_ref?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/site_checker/link.rb', line 58

def anchor_ref?
  @kind == :anchor_ref
end

#anchor_related?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/site_checker/link.rb', line 62

def anchor_related?
  anchor? || anchor_ref?
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/site_checker/link.rb', line 10

def eql?(other)
  @modified_url.eql? other.modified_url
end

#has_problem?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/site_checker/link.rb', line 42

def has_problem?
  @problem != nil
end

#hashObject



18
19
20
# File 'lib/site_checker/link.rb', line 18

def hash
  @modified_url.hash
end

#local_image?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/site_checker/link.rb', line 50

def local_image?
  @location == :local && @kind == :image
end

#local_page?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/site_checker/link.rb', line 46

def local_page?
  @location == :local && @kind == :page
end