Class: Evesync::IPC::Data::Package

Inherits:
Object
  • Object
show all
Extended by:
Unhashable
Includes:
Hashable
Defined in:
lib/evesync/ipc/data/package.rb

Defined Under Namespace

Modules: Command

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Unhashable

from_hash

Methods included from Hashable

#to_hash

Constructor Details

#initialize(params) ⇒ Package

Returns a new instance of Package.



20
21
22
23
24
25
# File 'lib/evesync/ipc/data/package.rb', line 20

def initialize(params)
  @name = params[:name].freeze
  @version = params[:version].freeze
  @command = parse_command(params[:command]).freeze
  @timestamp = params[:timestamp] || NTP.timestamp
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



18
19
20
# File 'lib/evesync/ipc/data/package.rb', line 18

def command
  @command
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/evesync/ipc/data/package.rb', line 18

def name
  @name
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



18
19
20
# File 'lib/evesync/ipc/data/package.rb', line 18

def timestamp
  @timestamp
end

#versionObject (readonly)

Returns the value of attribute version.



18
19
20
# File 'lib/evesync/ipc/data/package.rb', line 18

def version
  @version
end

Instance Method Details

#==(pkg) ⇒ Object



27
28
29
30
31
# File 'lib/evesync/ipc/data/package.rb', line 27

def ==(pkg)
  (pkg.name == @name) &&
    (pkg.version == @version) &&
    (pkg.command == @command)
end

#to_sObject



33
34
35
# File 'lib/evesync/ipc/data/package.rb', line 33

def to_s
  "Package(#{@command.upcase}: #{name}-#{@version})"
end