Class: Waw::StaticController::AbstractMatcher

Inherits:
Object
  • Object
show all
Includes:
Waw::ScopeUtils
Defined in:
lib/waw/controllers/static/matcher.rb

Direct Known Subclasses

AndMatcher, Matcher, NegateMatcher, OrMatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Waw::ScopeUtils

#config, #find_kernel_context, #logger, #params, #rack_env, #real_session, #request, #resources, #response, #root_folder, #session

Constructor Details

#initialize(wawaccess) ⇒ AbstractMatcher

Returns a new instance of AbstractMatcher.



9
10
11
# File 'lib/waw/controllers/static/matcher.rb', line 9

def initialize(wawaccess)
  @wawaccess = wawaccess
end

Instance Attribute Details

#wawaccessObject (readonly)

Waw access on which this matcher is defined



7
8
9
# File 'lib/waw/controllers/static/matcher.rb', line 7

def wawaccess
  @wawaccess
end

Instance Method Details

#&(other) ⇒ Object



23
24
25
26
27
28
# File 'lib/waw/controllers/static/matcher.rb', line 23

def &(other)
  unless other.is_a?(AbstractMatcher)
    raise ArgumentError, "Matcher expected for &, #{other} received"
  end
  AndMatcher.new(wawaccess, self, other)
end

#folderObject

Returns wawaccess’s folder



14
15
16
# File 'lib/waw/controllers/static/matcher.rb', line 14

def folder
  wawaccess.folder
end

#negateObject



37
38
39
# File 'lib/waw/controllers/static/matcher.rb', line 37

def negate
  NegateMatcher.new(wawaccess, self)
end

#req_pathObject

Returns requested path



19
20
21
# File 'lib/waw/controllers/static/matcher.rb', line 19

def req_path
  wawaccess.req_path
end

#|(other) ⇒ Object



30
31
32
33
34
35
# File 'lib/waw/controllers/static/matcher.rb', line 30

def |(other)
  unless other.is_a?(AbstractMatcher)
    raise ArgumentError, "Matcher expected for |, #{other} received"
  end
  OrMatcher.new(wawaccess, self, other)
end