Class: Aranha::DefaultProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/aranha/default_processor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_uri, extra_data) ⇒ DefaultProcessor

Returns a new instance of DefaultProcessor.



18
19
20
21
# File 'lib/aranha/default_processor.rb', line 18

def initialize(source_uri, extra_data)
  @source_uri = self.class.sanitize_uri(source_uri)
  @extra_data = extra_data
end

Instance Attribute Details

#extra_dataObject (readonly)

Returns the value of attribute extra_data.



7
8
9
# File 'lib/aranha/default_processor.rb', line 7

def extra_data
  @extra_data
end

#source_uriObject (readonly)

Returns the value of attribute source_uri.



7
8
9
# File 'lib/aranha/default_processor.rb', line 7

def source_uri
  @source_uri
end

Class Method Details

.sanitize_uri(uri) ⇒ Object



10
11
12
13
14
15
# File 'lib/aranha/default_processor.rb', line 10

def sanitize_uri(uri)
  return uri if uri.is_a?(Hash)

  uri = uri.to_s.gsub(%r{\A/}, 'file:///') unless uri.is_a?(Addressable::URI)
  Addressable::URI.parse(uri)
end

Instance Method Details

#processObject



23
24
25
# File 'lib/aranha/default_processor.rb', line 23

def process
  raise 'Implement method process'
end