Class: Evesync::IPC::Data::File
- Inherits:
-
Object
- Object
- Evesync::IPC::Data::File
- Extended by:
- Unhashable
- Includes:
- Hashable
- Defined in:
- lib/evesync/ipc/data/file.rb
Defined Under Namespace
Modules: Action
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#content ⇒ Object
readonly
The content of a file for remote call.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(params) ⇒ File
constructor
A new instance of File.
Methods included from Unhashable
Methods included from Hashable
Constructor Details
#initialize(params) ⇒ File
20 21 22 23 24 25 26 |
# File 'lib/evesync/ipc/data/file.rb', line 20 def initialize(params) @name = params[:name].freeze @mode = params[:mode].freeze @action = parse_action(params[:action]).freeze = params[:timestamp] || NTP. @content = params[:content] || IO.read(@name).freeze if ::File.exist? @name end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
18 19 20 |
# File 'lib/evesync/ipc/data/file.rb', line 18 def action @action end |
#content ⇒ Object (readonly)
The content of a file for remote call. Sends as
a plain text(?), no extra calls between machines.
TODO
* Think about binary data
* Encoding information
* Large file sending
43 44 45 |
# File 'lib/evesync/ipc/data/file.rb', line 43 def content @content end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
18 19 20 |
# File 'lib/evesync/ipc/data/file.rb', line 18 def mode @mode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/evesync/ipc/data/file.rb', line 18 def name @name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
18 19 20 |
# File 'lib/evesync/ipc/data/file.rb', line 18 def end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/evesync/ipc/data/file.rb', line 28 def ==(other) (@name == other.name) && (@action == other.action) && (@mode == other.mode) # timestamps may differ # conten comparing may cost too much end |