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.



37
38
39
40
41
42
43
44
45
# File 'lib/envjs/net/file.rb', line 37

def initialize path
  @path = path
  on_open = Envjs::Net::File.on_open
  on_open and on_open.call( 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.



71
72
73
# File 'lib/envjs/net/file.rb', line 71

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



71
72
73
# File 'lib/envjs/net/file.rb', line 71

def code
  @code
end

Instance Method Details

#[](*args) ⇒ Object



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

def [] *args
  nil
end

#each(&block) ⇒ Object



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

def each &block
end

#getContentEncodingObject



58
59
60
# File 'lib/envjs/net/file.rb', line 58

def getContentEncoding
  nil
end

#getHeaderFieldsObject



54
55
56
# File 'lib/envjs/net/file.rb', line 54

def getHeaderFields
  []
end

#getInputStreamObject



67
68
69
# File 'lib/envjs/net/file.rb', line 67

def getInputStream
  self
end

#getResponseCodeObject



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

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