Class: Rstreamor::File

Inherits:
Object
  • Object
show all
Defined in:
lib/rstreamor/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ File

Returns a new instance of File.



5
6
7
# File 'lib/rstreamor/file.rb', line 5

def initialize(file)
  self.file = file
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/rstreamor/file.rb', line 3

def file
  @file
end

Instance Method Details

#content_typeObject



17
18
19
# File 'lib/rstreamor/file.rb', line 17

def content_type
  self.file.content_type
end

#dataObject



9
10
11
12
13
14
15
# File 'lib/rstreamor/file.rb', line 9

def data
  if self.file.respond_to? :data
    self.file.data
  else
    self.file.read
  end
end

#sizeObject



21
22
23
# File 'lib/rstreamor/file.rb', line 21

def size
  data.size
end