Class: MirrorDb::Model::Page
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MirrorDb::Model::Page
- Defined in:
- lib/webget/mirror/database/models.rb
Instance Method Summary collapse
-
#backlink_pages ⇒ Object
use incoming_pages or backlink_pages?.
-
#cached ⇒ Object
find a better name for not cached (was missing)? why? why not? cached a.k.a.
-
#html ⇒ Object
for extname (file extensions) note - .html auto incl .htm !!.
- #html? ⇒ Boolean
-
#incoming_links ⇒ Object
backlink (incoming).
- #incoming_paths ⇒ Object
-
#linked_pages ⇒ Object
use outgoing_pages or linked_pages?.
- #not_cached? ⇒ Boolean
-
#not_found ⇒ Object
404 not_found.
- #not_found? ⇒ Boolean
- #not_html? ⇒ Boolean
- #outgoing_paths ⇒ Object
- #pdf? ⇒ Boolean
Instance Method Details
#backlink_pages ⇒ Object
use incoming_pages or backlink_pages?
26 27 |
# File 'lib/webget/mirror/database/models.rb', line 26 has_many :backlink_pages, :through => :incoming_links, :source => :from_page |
#cached ⇒ Object
find a better name for not cached (was missing)? why? why not? cached a.k.a. downloaded to local cache
36 |
# File 'lib/webget/mirror/database/models.rb', line 36 scope :cached, -> { where( cached: true ) } |
#html ⇒ Object
for extname (file extensions) note - .html auto incl .htm !!
47 |
# File 'lib/webget/mirror/database/models.rb', line 47 scope :html, -> { where( extname: ['.html', '.htm']) } |
#html? ⇒ Boolean
50 |
# File 'lib/webget/mirror/database/models.rb', line 50 def html?() extname == '.html' || extname == '.htm'; end |
#incoming_links ⇒ Object
backlink (incoming)
21 22 23 |
# File 'lib/webget/mirror/database/models.rb', line 21 has_many :incoming_links, class_name: 'Link', foreign_key: 'to_page_id', :dependent => :delete_all |
#incoming_paths ⇒ Object
31 |
# File 'lib/webget/mirror/database/models.rb', line 31 def incoming_paths() backlink_pages.pluck(:path); end |
#linked_pages ⇒ Object
use outgoing_pages or linked_pages?
17 18 |
# File 'lib/webget/mirror/database/models.rb', line 17 has_many :linked_pages, :through => :outgoing_links, :source => :to_page |
#not_cached? ⇒ Boolean
56 |
# File 'lib/webget/mirror/database/models.rb', line 56 def not_cached?() !cached?(); end |
#not_found ⇒ Object
404 not_found
40 |
# File 'lib/webget/mirror/database/models.rb', line 40 scope :not_found, -> { where( http_status: 404 ) } |
#not_found? ⇒ Boolean
55 |
# File 'lib/webget/mirror/database/models.rb', line 55 def not_found?() http_status == 404; end |
#not_html? ⇒ Boolean
51 |
# File 'lib/webget/mirror/database/models.rb', line 51 def not_html?() !html?(); end |
#outgoing_paths ⇒ Object
30 |
# File 'lib/webget/mirror/database/models.rb', line 30 def outgoing_paths() linked_pages.pluck(:path); end |
#pdf? ⇒ Boolean
52 |
# File 'lib/webget/mirror/database/models.rb', line 52 def pdf?() extname == '.pdf'; end |