Class: Vmstator::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/vmstator/cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = false) ⇒ Cache

Returns a new instance of Cache.



10
11
12
13
14
15
# File 'lib/vmstator/cache.rb', line 10

def initialize(data=false)
  if data
    update(data)
  end
  true
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/vmstator/cache.rb', line 5

def name
  @name
end

#numObject (readonly)

Returns the value of attribute num.



4
5
6
# File 'lib/vmstator/cache.rb', line 4

def num
  @num
end

#pagesObject (readonly)

Returns the value of attribute pages.



8
9
10
# File 'lib/vmstator/cache.rb', line 8

def pages
  @pages
end

#sizeObject (readonly)

Returns the value of attribute size.



6
7
8
# File 'lib/vmstator/cache.rb', line 6

def size
  @size
end

#totalObject (readonly)

Returns the value of attribute total.



7
8
9
# File 'lib/vmstator/cache.rb', line 7

def total
  @total
end

Instance Method Details

#update(data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vmstator/cache.rb', line 17

def update(data)
  if data
    @num   = data[:num]
    @name  = data[:name]
    @sec   = data[:size]
    @total = data[:total]
    @pages = data[:pages]
  else
    return false
  end
  true
end