pion 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pion.rb +5 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 419ed957397c6a0e9c837a01aea0b3dbef96069c
4
- data.tar.gz: 71570724f2a77cb4236525edbd7ded1a3ba4073d
3
+ metadata.gz: d488fdce446400ab2ebc04a1a49467b2e4581217
4
+ data.tar.gz: 202de5134d57fb642ed01c2a1decf751d8c26572
5
5
  SHA512:
6
- metadata.gz: 434ba66dd46b37da20c5296d5e16cea37b2ac672abdd6ab3efe32d99e78c9ba7f1358e3a13fe55e3552aafe27e1002821e8b411315e3db57f0a8d975bc1851ea
7
- data.tar.gz: 70370dca9cba835473a71dcf6118fbb3b1d0709ccb5fcf356c0322d3d782e75da09ada6e57014d61bb4e59b8bab370110cb30b506ddb199639d61cfd39a9ab24
6
+ metadata.gz: 20b0985951ee2799029e3bcb78e386cdfd01805c0981799ede57eaa62896cb965875c6570f1059677eb6b3f212d2c10a7ffde69ee2ac76d00c7f5ddeff05f5f7
7
+ data.tar.gz: 2d75ffb4cb653ac648fbf66d02618e28efba5b4624eec6376c1ed2f7d7462a3f350eb24d03fbdec427f6763dbd3a6ab79396feb789f5ae9faf571f2a0759411c
data/lib/pion.rb CHANGED
@@ -1,13 +1,15 @@
1
1
  class Pion
2
2
  # Version number for Pion
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
 
5
5
  # Initialize a new Pion object
6
- def initialize(directory, extension = "html")
6
+ def initialize(directory, extension = "html", separator = "/")
7
7
  raise ArgumentError, "Extension name must be a string." unless extension.is_a? String
8
+ raise ArgumentError, "Directory separator must be a string." unless separator.is_a? String
8
9
 
9
10
  @directory = method(:get_directory).call directory
10
11
  @extension = extension.gsub /\A\./, ""
12
+ @separator = separator
11
13
  end
12
14
 
13
15
  # Generate urls from files
@@ -35,6 +37,7 @@ class Pion
35
37
  def get_url(file)
36
38
  url = file.gsub /\A#{@directory}/, ""
37
39
  url = url.gsub /(\/index)?\.#{@extension}\z/, ""
40
+ url = url.gsub /#{Regexp.escape(@separator)}/, "/"
38
41
 
39
42
  url == "" ? "/" : url
40
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Palmér