Class: CompassConnector::FakeFile

Inherits:
File
  • Object
show all
Defined in:
lib/compass-connector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ FakeFile

Returns a new instance of FakeFile.



12
13
14
15
16
17
18
# File 'lib/compass-connector.rb', line 12

def initialize(data)
  path = "/tmp/"+data["hash"]+"."+data["ext"]
  super path, "w+b"
  write(Base64.decode64(data["data"]))
  rewind()
  File.utime(Time.new, Time.at(data["mtime"]), path)
end

Class Method Details

.from_response(response) ⇒ Object



20
21
22
23
24
# File 'lib/compass-connector.rb', line 20

def self.from_response(response)
  if response
    FakeFile.new(response)
  end
end