Class: RedSnapper::Group

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGroup

Returns a new instance of Group.



14
15
16
17
# File 'lib/redsnapper.rb', line 14

def initialize
  @files = []
  @size = 0
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



13
14
15
# File 'lib/redsnapper.rb', line 13

def files
  @files
end

#sizeObject (readonly)

Returns the value of attribute size.



13
14
15
# File 'lib/redsnapper.rb', line 13

def size
  @size
end

Instance Method Details

#<=>(other) ⇒ Object



22
23
24
# File 'lib/redsnapper.rb', line 22

def <=>(other)
  other.size <=> size
end

#add(name, size) ⇒ Object



18
19
20
21
# File 'lib/redsnapper.rb', line 18

def add(name, size)
  @files << name
  @size += size
end