Class: Exfuz::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/exfuz/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max) ⇒ Status

Returns a new instance of Status.



7
8
9
10
# File 'lib/exfuz/status.rb', line 7

def initialize(max)
  @loaded = 0
  @max = max
end

Instance Attribute Details

#loadedObject (readonly)

Returns the value of attribute loaded.



5
6
7
# File 'lib/exfuz/status.rb', line 5

def loaded
  @loaded
end

#maxObject (readonly)

Returns the value of attribute max.



5
6
7
# File 'lib/exfuz/status.rb', line 5

def max
  @max
end

Instance Method Details

#finished?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/exfuz/status.rb', line 16

def finished?
  @loaded == @max
end

#to_sObject

TODO: メソッド名を変更すること



21
22
23
# File 'lib/exfuz/status.rb', line 21

def to_s
  "[#{@loaded}/#{@max}]"
end

#update(num) ⇒ Object



12
13
14
# File 'lib/exfuz/status.rb', line 12

def update(num)
  @loaded += num
end