Class: Envjs::Net::File::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Response

Returns a new instance of Response.



33
34
35
36
37
38
39
# File 'lib/envjs/net/file.rb', line 33

def initialize path
  @path = path
  @file = File.new @path
  @body = @file.read
  @code = @file.nil? ? "404" : "200";
  @file.close
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



65
66
67
# File 'lib/envjs/net/file.rb', line 65

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



65
66
67
# File 'lib/envjs/net/file.rb', line 65

def code
  @code
end

Instance Method Details

#[](*args) ⇒ Object



41
42
43
# File 'lib/envjs/net/file.rb', line 41

def [] *args
  nil
end

#each(&block) ⇒ Object



45
46
# File 'lib/envjs/net/file.rb', line 45

def each &block
end

#getContentEncodingObject



52
53
54
# File 'lib/envjs/net/file.rb', line 52

def getContentEncoding
  nil
end

#getHeaderFieldsObject



48
49
50
# File 'lib/envjs/net/file.rb', line 48

def getHeaderFields
  []
end

#getInputStreamObject



61
62
63
# File 'lib/envjs/net/file.rb', line 61

def getInputStream
  self
end

#getResponseCodeObject



56
57
58
# File 'lib/envjs/net/file.rb', line 56

def getResponseCode
  @file.nil? ? 404 : 200;
end