class Evesync::IPC::Data::File
Attributes
action[R]
content[R]
mode[R]
name[R]
timestamp[R]
Public Class Methods
new(params)
click to toggle source
# 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 @timestamp = params[:timestamp] || NTP.timestamp @content = params[:content] || IO.read(@name).freeze if ::File.exist? @name end
Public Instance Methods
==(other)
click to toggle source
# 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
Private Instance Methods
parse_action(action)
click to toggle source
# File lib/evesync/ipc/data/file.rb, line 47 def parse_action(action) case action.to_s when /modify/i result = Action::MODIFY when /delete/i result = Action::DELETE when /moved_to/i result = Action::MOVED_TO when /create/i result = Action::CREATE end result end