Class: ChupaText::InputData
- Inherits:
-
Data
- Object
- Data
- ChupaText::InputData
show all
- Defined in:
- lib/chupa-text/input-data.rb
Instance Attribute Summary
Attributes inherited from Data
#attributes, #expected_screenshot_size, #limit_as, #limit_cpu, #max_body_size, #need_screenshot, #path, #screenshot, #source, #timeout, #uri
Instance Method Summary
collapse
Methods inherited from Data
#[], #[]=, #extension, #initialize_copy, #merge!, #mime_type, #mime_type=, #need_screenshot?, #text?, #text_plain?, #to_utf8_body_data
Constructor Details
#initialize(uri, options = {}) ⇒ InputData
Returns a new instance of InputData.
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/chupa-text/input-data.rb', line 23
def initialize(uri, options={})
super(options)
self.uri = uri
case @uri
when URI::HTTP, URI::FTP
@content = download
self.path = @content.path
else
@content = FileContent.new(path)
end
end
|
Instance Method Details
#body ⇒ Object
35
36
37
|
# File 'lib/chupa-text/input-data.rb', line 35
def body
@content.body
end
|
#open(&block) ⇒ Object
47
48
49
|
# File 'lib/chupa-text/input-data.rb', line 47
def open(&block)
@content.open(&block)
end
|
#peek_body(size) ⇒ Object
39
40
41
|
# File 'lib/chupa-text/input-data.rb', line 39
def peek_body(size)
@content.peek_body(size)
end
|
#release ⇒ Object
51
52
53
|
# File 'lib/chupa-text/input-data.rb', line 51
def release
@content.release
end
|
#size ⇒ Object
43
44
45
|
# File 'lib/chupa-text/input-data.rb', line 43
def size
@content.size
end
|