Class: OsCtl::Lib::IdMap::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/libosctl/id_map.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count

Returns:

  • (Object)

    the current value of count



4
5
6
# File 'lib/libosctl/id_map.rb', line 4

def count
  @count
end

#host_idObject

Returns the value of attribute host_id

Returns:

  • (Object)

    the current value of host_id



4
5
6
# File 'lib/libosctl/id_map.rb', line 4

def host_id
  @host_id
end

#ns_idObject

Returns the value of attribute ns_id

Returns:

  • (Object)

    the current value of ns_id



4
5
6
# File 'lib/libosctl/id_map.rb', line 4

def ns_id
  @ns_id
end

Class Method Details

.from_string(str, separator: ':') ⇒ Object



5
6
7
8
# File 'lib/libosctl/id_map.rb', line 5

def self.from_string(str, separator: ':')
  ns_id, host_id, cnt = str.split(separator)
  Entry.new(ns_id.to_i, host_id.to_i, cnt.to_i)
end

Instance Method Details

#to_aObject



10
11
12
# File 'lib/libosctl/id_map.rb', line 10

def to_a
  [ns_id, host_id, count]
end

#to_sObject



14
15
16
# File 'lib/libosctl/id_map.rb', line 14

def to_s
  "#{ns_id}:#{host_id}:#{count}"
end