Class: Brutalismbot::S3::Prefix

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/brutalismbot/s3/prefix.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix, &block) ⇒ Prefix

Returns a new instance of Prefix.



11
12
13
14
# File 'lib/brutalismbot/s3/prefix.rb', line 11

def initialize(prefix, &block)
  @prefix = prefix
  @block  = block if block_given?
end

Instance Method Details

#allObject



22
23
24
# File 'lib/brutalismbot/s3/prefix.rb', line 22

def all
  to_a
end

#eachObject



16
17
18
19
20
# File 'lib/brutalismbot/s3/prefix.rb', line 16

def each
  @prefix.each do |object|
    yield @block.nil? ? object : @block.call(object)
  end
end

#lastObject



26
27
28
# File 'lib/brutalismbot/s3/prefix.rb', line 26

def last
  to_a.last
end