File: web.rb

package info (click to toggle)
mikutter 3.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,256 kB
  • ctags: 2,165
  • sloc: ruby: 19,079; sh: 205; makefile: 20
file content (19 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# -*- coding: utf-8 -*-

=begin rdoc
Web上のリソースを示す汎用的なModel。
これ自体が特別な機能は提供せず、単にURLがWeb上のリソースを指し示していることを表わすために使う。

例えば、URLはWebブラウザで開くことができるが、intentは最終的に全てModelに変換できなければならないため、Modelが用意されていない多くのURLは取り扱うことができない。
=end
module Plugin::Web
  class Web < Retriever::Model
    register :web

    field.uri :perma_link

    handle ->uri{ %w<http https>.include?(uri.scheme) } do |uri|
      new(perma_link: uri)
    end
  end
end