Class: Envjs::Net::File::Response
- Inherits:
-
Object
- Object
- Envjs::Net::File::Response
- Defined in:
- lib/envjs/net/file.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
- #[](*args) ⇒ Object
- #each(&block) ⇒ Object
- #getContentEncoding ⇒ Object
- #getHeaderFields ⇒ Object
- #getInputStream ⇒ Object
- #getResponseCode ⇒ Object
-
#initialize(path) ⇒ Response
constructor
A new instance of Response.
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
71 72 73 |
# File 'lib/envjs/net/file.rb', line 71 def body @body end |
#code ⇒ Object (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 |
#getContentEncoding ⇒ Object
58 59 60 |
# File 'lib/envjs/net/file.rb', line 58 def getContentEncoding nil end |
#getHeaderFields ⇒ Object
54 55 56 |
# File 'lib/envjs/net/file.rb', line 54 def getHeaderFields [] end |
#getInputStream ⇒ Object
67 68 69 |
# File 'lib/envjs/net/file.rb', line 67 def getInputStream self end |
#getResponseCode ⇒ Object
62 63 64 |
# File 'lib/envjs/net/file.rb', line 62 def getResponseCode @file.nil? ? 404 : 200; end |