Class: ChupaText::VirtualFileData

Inherits:
Data
  • Object
show all
Defined in:
lib/chupa-text/virtual-file-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, input, options = {}) ⇒ VirtualFileData

Returns a new instance of VirtualFileData.



19
20
21
22
23
24
# File 'lib/chupa-text/virtual-file-data.rb', line 19

def initialize(uri, input, options={})
  super(options)
  self.uri = uri
  @content = VirtualContent.new(input, path)
  self.path = @content.path
end

Instance Method Details

#bodyObject



26
27
28
# File 'lib/chupa-text/virtual-file-data.rb', line 26

def body
  @content.body
end

#open(&block) ⇒ Object



38
39
40
# File 'lib/chupa-text/virtual-file-data.rb', line 38

def open(&block)
  @content.open(&block)
end

#peek_body(size) ⇒ Object



30
31
32
# File 'lib/chupa-text/virtual-file-data.rb', line 30

def peek_body(size)
  @content.peek_body(size)
end

#releaseObject



42
43
44
# File 'lib/chupa-text/virtual-file-data.rb', line 42

def release
  @content.release
end

#sizeObject



34
35
36
# File 'lib/chupa-text/virtual-file-data.rb', line 34

def size
  @content.size
end