Class: Mangos::PagesInflater

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

Instance Method Summary collapse

Constructor Details

#initialize(page_paths) ⇒ PagesInflater

Returns a new instance of PagesInflater.



2
3
4
# File 'lib/mangos/pages_inflater.rb', line 2

def initialize(page_paths)
  @page_paths = page_paths
end

Instance Method Details

#inflateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mangos/pages_inflater.rb', line 6

def inflate
  paths = []

  @page_paths.split("|").each do |part|
    if part.include?("/")
      name, count = part.split("/")

      last_base, last_ext = name.split(".")

      paths << name

      count.to_i.times do
        last_base.succ!
        paths << "#{last_base}.#{last_ext}"
      end
    else
      paths << part
    end
  end

  paths
end