onde 0.0.1 → 0.0.2

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/onde/version.rb +1 -1
  3. data/lib/onde.rb +15 -8
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e815757258d4d0a205ed6fce17bbd7f705a050f5
4
- data.tar.gz: a1402b5c6760c9da5396d8cd55a40d4816ff8846
3
+ metadata.gz: 4603e2a0c10686da022fe2fc1156b3d23784f1dc
4
+ data.tar.gz: 64e03b8c2844be20ca470aa886c03c0d636278e8
5
5
  SHA512:
6
- metadata.gz: 0642d14882f48998c9d2fb1f09a9d044f5249b47f4d660cce88571cfc23e3f9d7465ebad5b9407746ea343f0b2b59df2e51a4b5f58e68224611d27802ca87b8b
7
- data.tar.gz: c959f9552d41070ce8245491b735c1d75028968d55d31340236ef3eaad6dd72d0ae91e5293936ecff525006f432fdcfdc7a7c44dbff4cba22e71ba382581b44b
6
+ metadata.gz: 90e825dcd537a129b755d73bdfd3f9607855655687f5799cb7f1dfaab9484ae1ac0af415531ebc3dda0292a96c40f2cb38394a45c2712a89a1e9006a5f11f24e
7
+ data.tar.gz: a324afce19aedde254b5a5835cf58c6448632b404230b9b52591a7997671a22ed97e386374d9361a98312277bedfb5ba946b7997dc20a816e76d69a8a6ac3356
data/lib/onde/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Onde
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/onde.rb CHANGED
@@ -20,23 +20,30 @@ class Onde
20
20
  @@onde_file_path ||= '.onde.yml'
21
21
  end
22
22
 
23
- def path(path_alias, kwargs={})
23
+ def path(path_alias, variables={}, options={})
24
24
  _path = paths[path_alias.to_sym]
25
25
 
26
- escape = kwargs.delete(:escape)
27
- escape = true if escape.nil?
28
-
29
- if kwargs
30
- kwargs.each do |variable, value|
26
+ if variables
27
+ variables.each do |variable, value|
31
28
  _path = _path.gsub(/<#{variable}>/, value)
32
29
  end
33
30
  end
34
31
 
35
32
  if !!(_path =~ /<.*?>/)
36
- raise Onde::ArgumentsError
33
+ raise Onde::ArgumentsError.new("No value supplied for the variable #{ _path.scan(/<.*?>/)[0] }")
37
34
  end
38
35
 
39
- _path = _path.gsub(/ /, '\ ') if escape
36
+ escape_spaces = options[:escape_spaces]
37
+ escape_spaces = true if escape_spaces.nil?
38
+ _path = _path.gsub(/ /, '\ ') if escape_spaces
39
+
40
+ terminal_slash = options[:terminal_slash]
41
+ terminal_slash = false if terminal_slash.nil?
42
+ _path = _path + '/' if terminal_slash and !(_path =~ /\/\z/)
43
+
44
+ expand_home = options[:expand_home_dir]
45
+ expand_home = true if expand_home.nil?
46
+ _path = _path.sub(/\A~/, Dir.home) if expand_home
40
47
 
41
48
  _path
42
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Knight