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, #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, input, options = {}) ⇒ VirtualFileData

Returns a new instance of VirtualFileData.



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

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

Instance Method Details

#bodyObject



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

def body
  @content.body
end

#open(&block) ⇒ Object



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

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

#pathObject



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

def path
  @content.path
end

#sizeObject



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

def size
  @content.size
end