Module: Pebblebed::Uid::WildcardPath
- Defined in:
- lib/pebblebed/uid.rb
Class Method Summary collapse
-
.carets_are_leading?(path) ⇒ Boolean
a.^b.c is valid a.b^c.d is not.
-
.pipes_are_interleaved?(path) ⇒ Boolean
a.b|c.d is valid a.|b.c is not.
-
.stars_are_solitary?(path) ⇒ Boolean
a.*.c is valid a.*b.c is not.
-
.stars_are_terminating?(path) ⇒ Boolean
a.b.* is valid *.b.c is not.
- .valid?(path) ⇒ Boolean
Class Method Details
.carets_are_leading?(path) ⇒ Boolean
a.^b.c is valid a.b^c.d is not
133 134 135 |
# File 'lib/pebblebed/uid.rb', line 133 def carets_are_leading?(path) !path.split('.').any? {|s| s.match(/.+\^|\^$/) } end |
.pipes_are_interleaved?(path) ⇒ Boolean
a.b|c.d is valid a.|b.c is not
127 128 129 |
# File 'lib/pebblebed/uid.rb', line 127 def pipes_are_interleaved?(path) !path.split('.').any? {|s| s.match(/^\||\|$/)} end |
.stars_are_solitary?(path) ⇒ Boolean
a.*.c is valid a.*b.c is not
121 122 123 |
# File 'lib/pebblebed/uid.rb', line 121 def stars_are_solitary?(path) !path.split('.').any? {|s| s.match(/.+\*|\*.+/)} end |
.stars_are_terminating?(path) ⇒ Boolean
a.b.* is valid *.b.c is not
139 140 141 |
# File 'lib/pebblebed/uid.rb', line 139 def stars_are_terminating?(path) path !~ /.*\*\.\w/ end |
.valid?(path) ⇒ Boolean
115 116 117 |
# File 'lib/pebblebed/uid.rb', line 115 def valid?(path) stars_are_solitary?(path) && pipes_are_interleaved?(path) && carets_are_leading?(path) && stars_are_terminating?(path) end |