Class: Waw::StaticController::Matcher

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

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, predicate) ⇒ Matcher

Creates a matcher instance



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

def initialize(wawaccess, predicate)
  @wawaccess = wawaccess
  @predicate = predicate
end

Instance Attribute Details

#predicateObject (readonly)

Matcher’s predicate



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

def predicate
  @predicate
end

#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

#folderObject

Returns wawaccess’s folder



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

def folder
  wawaccess.folder
end

#matches?(env) ⇒ Boolean

Does the matcher matches a given path?

Returns:



29
30
31
# File 'lib/waw/controllers/static/matcher.rb', line 29

def matches?(env)
  instance_eval &predicate
end

#req_pathObject

Returns requested path



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

def req_path
  wawaccess.req_path
end