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.



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

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

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



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

def files
  @files
end

#sizeObject (readonly)

Returns the value of attribute size.



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

def size
  @size
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#add(name, size) ⇒ Object



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

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