Class: RichUrls::Parsers::EmbedParser::Paste
- Inherits:
-
Base
- Object
- Base
- RichUrls::Parsers::EmbedParser::Paste
show all
- Defined in:
- lib/parsers/embed_parsers/paste.rb
Constant Summary
collapse
- IFRAME =
'<iframe src="https://pasteapp.com/p/%s/embed?view=%s" '\
'width="480" height="480" scrolling="no" '\
'frameborder="0" allowfullscreen></iframe>'.freeze
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#match? ⇒ Boolean
9
10
11
12
13
|
# File 'lib/parsers/embed_parsers/paste.rb', line 9
def match?
@uri.host == 'pasteapp.com' &&
@uri.path =~ /\/p\/[a-zA-Z0-9]+/ &&
!@uri.query.nil?
end
|
#parse ⇒ Object
15
16
17
18
19
|
# File 'lib/parsers/embed_parsers/paste.rb', line 15
def parse
path_id = @uri.path.sub(/\/p\//, '')
IFRAME % [path_id, query.fetch('view')]
end
|