Class: Peictt::Http::MATCH

Inherits:
Object show all
Defined in:
lib/peictt/http/match.rb

Constant Summary collapse

DEFAULT_METHODS =
%w(GET PATCH DELETE PUT POST).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regexp, options = {}) ⇒ MATCH

Returns a new instance of MATCH.



8
9
10
11
12
13
14
# File 'lib/peictt/http/match.rb', line 8

def initialize(regexp, options = {})
  @regexp = (regexp if regexp.is_a? Regexp) || regexp_error
  controller_error unless options.key? :controller
  set_controller options[:controller]
  @action = options[:action] || action_error
  get_verbs options[:methods]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



4
5
6
# File 'lib/peictt/http/match.rb', line 4

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller.



4
5
6
# File 'lib/peictt/http/match.rb', line 4

def controller
  @controller
end

#regexpObject (readonly)

Returns the value of attribute regexp.



4
5
6
# File 'lib/peictt/http/match.rb', line 4

def regexp
  @regexp
end

#verbObject (readonly)

Returns the value of attribute verb.



4
5
6
# File 'lib/peictt/http/match.rb', line 4

def verb
  @verb
end