Class: ChupaText::InputData

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

Instance Attribute Summary

Attributes inherited from Data

#attributes, #source, #uri

Instance Method Summary collapse

Methods inherited from Data

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

Constructor Details

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

Returns a new instance of InputData.



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

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

Instance Method Details

#bodyObject



32
33
34
# File 'lib/chupa-text/input-data.rb', line 32

def body
  @content.body
end

#open(&block) ⇒ Object



44
45
46
# File 'lib/chupa-text/input-data.rb', line 44

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

#pathObject



40
41
42
# File 'lib/chupa-text/input-data.rb', line 40

def path
  @content.path
end

#sizeObject



36
37
38
# File 'lib/chupa-text/input-data.rb', line 36

def size
  @content.size
end