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, #literal?, #|, #~

Constructor Details

#initialize(selector, prefix, suffix) ⇒ ElideCircumfix

Returns a new instance of ElideCircumfix.



191
192
193
194
# File 'lib/hx/path.rb', line 191

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

Class Method Details

.build(selector, prefix, suffix) ⇒ Object



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

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

Instance Method Details

#accept_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


196
197
198
# File 'lib/hx/path.rb', line 196

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