Class: BrmClient::Gateway::File
- Inherits:
-
Object
- Object
- BrmClient::Gateway::File
- Defined in:
- lib/brm_client/gateway/file.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(opts) ⇒ File
constructor
A new instance of File.
- #send_event(e) ⇒ Object
Constructor Details
#initialize(opts) ⇒ File
Returns a new instance of File.
7 8 9 10 |
# File 'lib/brm_client/gateway/file.rb', line 7 def initialize opts @path = opts[:path] || "/tmp/#{opts[:application]}.log" @file = open(@path, "w") end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/brm_client/gateway/file.rb', line 6 def file @file end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/brm_client/gateway/file.rb', line 6 def path @path end |
Instance Method Details
#disconnect ⇒ Object
12 13 14 |
# File 'lib/brm_client/gateway/file.rb', line 12 def disconnect @file.close end |
#send_event(e) ⇒ Object
16 17 18 |
# File 'lib/brm_client/gateway/file.rb', line 16 def send_event e @file.write "#{e.to_json}\n" end |