Class: ChupaText::InputData

Inherits:
Data
  • Object
show all
Defined in:
lib/chupa-text/input-data.rb

Instance Attribute Summary

Attributes inherited from Data

#attributes, #expected_screenshot_size, #need_screenshot, #path, #screenshot, #source, #uri

Instance Method Summary collapse

Methods inherited from Data

#[], #[]=, #extension, #initialize_copy, #merge!, #mime_type, #mime_type=, #need_screenshot?, #text?, #text_plain?

Constructor Details

#initialize(uri, options = {}) ⇒ InputData

Returns a new instance of InputData.



23
24
25
26
27
28
29
30
31
32
# File 'lib/chupa-text/input-data.rb', line 23

def initialize(uri, options={})
  super(options)
  self.uri = uri
  if @uri.class == URI::Generic
    @content = FileContent.new(path)
  else
    @content = download
    self.path = @content.path
  end
end

Instance Method Details

#bodyObject



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

def body
  @content.body
end

#open(&block) ⇒ Object



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

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

#sizeObject



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

def size
  @content.size
end