Module: Pebblebed::Uid::WildcardPath
- Defined in:
- lib/pebblebed/uid.rb
Class Method Summary collapse
-
.carets_are_leading?(path) ⇒ Boolean
a.^b.c is accepted a.b^c.d is not.
-
.pipes_are_interleaved?(path) ⇒ Boolean
a.b|c.d is accepted a.|b.c is not.
-
.stars_are_solitary?(path) ⇒ Boolean
a.*.c is accepted a.*b.c is not A later rule ensures that * always falls at the end of a path.
-
.stars_are_terminating?(path) ⇒ Boolean
a.b.* is accepted *.b.c is not.
- .valid?(path) ⇒ Boolean
Class Method Details
.carets_are_leading?(path) ⇒ Boolean
a.^b.c is accepted a.b^c.d is not
134 135 136 |
# File 'lib/pebblebed/uid.rb', line 134 def carets_are_leading?(path) !path.split('.').any? {|s| s.match(/.+\^|\^$/) } end |
.pipes_are_interleaved?(path) ⇒ Boolean
a.b|c.d is accepted a.|b.c is not
128 129 130 |
# File 'lib/pebblebed/uid.rb', line 128 def pipes_are_interleaved?(path) !path.split('.').any? {|s| s.match(/^\||\|$/)} end |
.stars_are_solitary?(path) ⇒ Boolean
a.*.c is accepted a.*b.c is not A later rule ensures that * always falls at the end of a path
122 123 124 |
# File 'lib/pebblebed/uid.rb', line 122 def stars_are_solitary?(path) !path.split('.').any? {|s| s.match(/.+\*|\*.+/)} end |
.stars_are_terminating?(path) ⇒ Boolean
a.b.* is accepted *.b.c is not
140 141 142 |
# File 'lib/pebblebed/uid.rb', line 140 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 |