Class: MagicResource::PathWithHttpVerb

Inherits:
String
  • Object
show all
Defined in:
lib/magic-resource/path_with_http_verb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_verb, path) ⇒ PathWithHttpVerb

Returns a new instance of PathWithHttpVerb.



5
6
7
8
9
10
11
# File 'lib/magic-resource/path_with_http_verb.rb', line 5

def initialize(http_verb, path)
  @http_verb = http_verb.kind_of?(self.class) ?
    http_verb.http_verb :
    http_verb.source.scan(/\w+/).first.try(:downcase).try(:to_sym)

  super(path)
end

Instance Attribute Details

#http_verbObject (readonly)

Returns the value of attribute http_verb.



3
4
5
# File 'lib/magic-resource/path_with_http_verb.rb', line 3

def http_verb
  @http_verb
end