Class: OvirtSDK4::BlockStatistic

Inherits:
Struct
  • Object
show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ BlockStatistic

Creates a new instance of the OvirtSDK4::BlockStatistic class.

Parameters:

  • opts (Hash) (defaults to: {})

    A hash containing the attributes of the object. The keys of the hash should be symbols corresponding to the names of the attributes. The values of the hash should be the values of the attributes.

Options Hash (opts):

  • :statistics (Array<Statistic>, Array<Hash>)

    The values of attribute statistics.



1444
1445
1446
1447
# File 'lib/ovirtsdk4/types.rb', line 1444

def initialize(opts = {})
  super(opts)
  self.statistics = opts[:statistics]
end

Instance Method Details

#==(other) ⇒ Object

Returns true if self and other have the same attributes and values.



1452
1453
1454
1455
# File 'lib/ovirtsdk4/types.rb', line 1452

def ==(other)
  super &&
  @statistics == other.statistics
end

#hashObject

Generates a hash value for this object.



1460
1461
1462
1463
# File 'lib/ovirtsdk4/types.rb', line 1460

def hash
  super +
  @statistics.hash
end

#statisticsArray<Statistic>

Returns the value of the statistics attribute.

Returns:



1413
1414
1415
# File 'lib/ovirtsdk4/types.rb', line 1413

def statistics
  @statistics
end

#statistics=(list) ⇒ Object

Sets the value of the statistics attribute.

Parameters:



1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
# File 'lib/ovirtsdk4/types.rb', line 1422

def statistics=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = Statistic.new(value)
      end
    end
  end
  @statistics = list
end