Class: Hx::Path::ElideCircumfix

Inherits:
Object
  • Object
show all
Includes:
Selector
Defined in:
lib/hx/path.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Selector

#&, #assume_circumfix, #elide_circumfix, #|, #~

Constructor Details

#initialize(selector, prefix, suffix) ⇒ ElideCircumfix

Returns a new instance of ElideCircumfix.



182
183
184
185
# File 'lib/hx/path.rb', line 182

def initialize(selector, prefix, suffix)
  @selector = selector
  @circumfix_re = Path.make_circumfix_re(prefix, suffix)
end

Class Method Details

.build(selector, prefix, suffix) ⇒ Object



178
179
180
# File 'lib/hx/path.rb', line 178

def self.build(selector, prefix, suffix)
  new(selector, prefix, suffix)
end

Instance Method Details

#accept_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


187
188
189
# File 'lib/hx/path.rb', line 187

def accept_path?(path)
  !!(path =~ @circumfix_re and @selector.accept_path?($1))
end