Class: Goat::ComponentUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/goat/common.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(skel, mutations, added, removed) ⇒ ComponentUpdate

Returns a new instance of ComponentUpdate.



60
61
62
63
64
65
# File 'lib/goat/common.rb', line 60

def initialize(skel, mutations, added, removed)
  @skel = skel
  @mutations = mutations
  @added = added
  @removed = removed
end

Instance Attribute Details

#addedObject (readonly)

Returns the value of attribute added.



57
58
59
# File 'lib/goat/common.rb', line 57

def added
  @added
end

#mutationsObject (readonly)

Returns the value of attribute mutations.



57
58
59
# File 'lib/goat/common.rb', line 57

def mutations
  @mutations
end

#removedObject (readonly)

Returns the value of attribute removed.



57
58
59
# File 'lib/goat/common.rb', line 57

def removed
  @removed
end

#skelObject (readonly)

Returns the value of attribute skel.



57
58
59
# File 'lib/goat/common.rb', line 57

def skel
  @skel
end

#versionObject

Returns the value of attribute version.



58
59
60
# File 'lib/goat/common.rb', line 58

def version
  @version
end

Class Method Details

.from_hash(h) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/goat/common.rb', line 76

def self.from_hash(h)
  self.new(
    ComponentSkeleton.from_hash(h['skel']),
    h['mutations'],
    h['added'].map{|a| ComponentSkeleton.from_hash(a)},
    h['removed']
  )
end

Instance Method Details

#to_hashObject



67
68
69
70
71
72
73
74
# File 'lib/goat/common.rb', line 67

def to_hash
  {
    'skel' => @skel.to_hash,
    'mutations' => @mutations,
    'added' => @added.map(&:to_hash),
    'removed' => @removed
  }
end