Class: HaveAPI::Route
- Inherits:
-
Object
- Object
- HaveAPI::Route
- Defined in:
- lib/haveapi/route.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#resource_path ⇒ Object
readonly
Returns the value of attribute resource_path.
-
#sinatra_path ⇒ Object
readonly
Returns the value of attribute sinatra_path.
Instance Method Summary collapse
- #description ⇒ Object
- #http_method ⇒ Object
-
#initialize(path, action, resource_path) ⇒ Route
constructor
A new instance of Route.
- #params ⇒ Object
Constructor Details
#initialize(path, action, resource_path) ⇒ Route
Returns a new instance of Route.
5 6 7 8 9 10 |
# File 'lib/haveapi/route.rb', line 5 def initialize(path, action, resource_path) @path = path @sinatra_path = path.gsub(/:([a-zA-Z\-_]+)/, '{\1}') @action = action @resource_path = resource_path end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/haveapi/route.rb', line 3 def action @action end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/haveapi/route.rb', line 3 def path @path end |
#resource_path ⇒ Object (readonly)
Returns the value of attribute resource_path.
3 4 5 |
# File 'lib/haveapi/route.rb', line 3 def resource_path @resource_path end |
#sinatra_path ⇒ Object (readonly)
Returns the value of attribute sinatra_path.
3 4 5 |
# File 'lib/haveapi/route.rb', line 3 def sinatra_path @sinatra_path end |
Instance Method Details
#description ⇒ Object
16 17 18 |
# File 'lib/haveapi/route.rb', line 16 def description @action.desc end |
#http_method ⇒ Object
12 13 14 |
# File 'lib/haveapi/route.rb', line 12 def http_method @action.http_method end |
#params ⇒ Object
20 21 22 |
# File 'lib/haveapi/route.rb', line 20 def params @action.params end |