Module: Enumerable

Defined in:
lib/romaniac/ext/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#each_with_roman_index(&block) ⇒ Object



11
12
13
# File 'lib/romaniac/ext/enumerable.rb', line 11

def each_with_roman_index(&block)
  with_roman_index(&block)
end

#with_roman_index(offset = 1) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/romaniac/ext/enumerable.rb', line 2

def with_roman_index(offset = 1)
  return to_enum(:with_roman_index, offset) unless block_given?
  each do |o|
    val = yield(o, Roman(offset))
    offset += 1
    val
  end
end