Class: Meta::PathMatchingMod

Inherits:
Module
  • Object
show all
Defined in:
lib/meta/application/path_matching_mod.rb

Instance Method Summary collapse

Constructor Details

#initialize(path_method: :path, matching_mode: :full) ⇒ PathMatchingMod

Returns a new instance of PathMatchingMod.



3
4
5
6
# File 'lib/meta/application/path_matching_mod.rb', line 3

def initialize(path_method: :path, matching_mode: :full)
  @path_method = path_method
  @matching_mode = matching_mode
end

Instance Method Details

#included(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/meta/application/path_matching_mod.rb', line 8

def included(base)
  path_method = @path_method
  matching_mode = @matching_mode

  base.class_eval do
    define_method(:path_matching) do
      @_path_matching ||= PathMatching.new(send(path_method), matching_mode)
    end
  end
end