Module: Extractula
- Defined in:
- lib/extractula/custom_extractors/dinosaur_comics.rb,
lib/extractula.rb,
lib/extractula.rb,
lib/extractula/oembed.rb,
lib/extractula/custom_extractors/vimeo.rb,
lib/extractula/custom_extractors/flickr.rb,
lib/extractula/custom_extractors/y_frog.rb,
lib/extractula/custom_extractors/twit_pic.rb,
lib/extractula/custom_extractors/you_tube.rb
Overview
This is mostly a proof-of-concept.
Defined Under Namespace
Modules: OEmbed
Classes: DinosaurComics, ExtractedContent, Extractor, Flickr, TwitPic, Vimeo, YFrog, YouTube
Constant Summary
collapse
- VERSION =
"0.0.11"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
Returns the value of attribute extractors.
18
19
20
|
# File 'lib/extractula.rb', line 18
def
@extractors
end
|
Returns the value of attribute last_extractor.
18
19
20
|
# File 'lib/extractula.rb', line 18
def
@last_extractor
end
|
Class Method Details
20
21
22
|
# File 'lib/extractula.rb', line 20
def ()
@extractors <<
end
|
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/extractula.rb', line 38
def (*args, &block)
config = args.last.is_a?(Hash) ? args.pop : {}
klass_name = args[0]
if block_given?
klass = Class.new Extractula::Extractor, &block
else
klass = Class.new Extractula::Extractor
klass.__send__ :include, Extractula::OEmbed if config.delete(:oembed)
config.each { |option, args| klass.__send__(option, *args) }
end
const_set klass_name, klass if klass_name
klass
end
|
28
29
30
31
32
|
# File 'lib/extractula.rb', line 28
def (url, html)
parsed_url, parsed_html = Domainatrix.parse(url), Nokogiri::HTML(html)
= parsed_url, parsed_html
.new(parsed_url, parsed_html).
end
|
24
25
26
|
# File 'lib/extractula.rb', line 24
def ()
@extractors.delete
end
|
34
35
36
|
# File 'lib/extractula.rb', line 34
def url, html
@last_extractor = @extractors.detect {|e| e. url, html} || Extractor
end
|