Class: Pione::Package::ParentPackageInfo

Inherits:
StructX
  • Object
show all
Defined in:
lib/pione/package/package-info.rb

Overview

ParentPackageInfo is a information set about parent package.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_create(data) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/pione/package/package-info.rb', line 59

def self.json_create(data)
  args = Hash.new
  args[:name] = data["PackageName"]
  args[:editor] = data["Editor"] if data.has_key?("Editor")
  args[:tag] = data["Tag"] if data.has_key?("Tag")
  new(args)
end

Instance Method Details

#<=>(other) ⇒ Object



67
68
69
70
71
# File 'lib/pione/package/package-info.rb', line 67

def <=>(other)
  (name <=> other.name).tap {|x| return x unless x == 0}
  (editor <=> other.editor).tap {|x| return x unless x == 0}
  (tag <=> other.tag).tap {|x| return x unless x == 0}
end

#to_json(*args) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/pione/package/package-info.rb', line 73

def to_json(*args)
  data = {}
  data["PackageName"] = name
  data["Editor"] = editor if editor
  data["Tag"] = tag if tag
  data.to_json(*args)
end