Class: Docs::RoutesCollection::Item
- Inherits:
-
Object
- Object
- Docs::RoutesCollection::Item
- Defined in:
- app/models/docs/routes_collection.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#path ⇒ Object
Returns the value of attribute path.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#reqs ⇒ Object
Returns the value of attribute reqs.
-
#via ⇒ Object
Returns the value of attribute via.
Instance Method Summary collapse
-
#initialize(route) ⇒ Item
constructor
A new instance of Item.
- #inspect ⇒ Object
- #to_page_attributes ⇒ Object
Constructor Details
#initialize(route) ⇒ Item
Returns a new instance of Item.
27 28 29 30 31 32 33 |
# File 'app/models/docs/routes_collection.rb', line 27 def initialize(route) @path = route.path.sub(/\(\.:format\)$/, '.json') @via = route.verb @reqs = route.reqs @pattern = route.json_regexp @controller, @action = reqs.split("#") end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
25 26 27 |
# File 'app/models/docs/routes_collection.rb', line 25 def action @action end |
#controller ⇒ Object
Returns the value of attribute controller.
25 26 27 |
# File 'app/models/docs/routes_collection.rb', line 25 def controller @controller end |
#path ⇒ Object
Returns the value of attribute path.
25 26 27 |
# File 'app/models/docs/routes_collection.rb', line 25 def path @path end |
#pattern ⇒ Object
Returns the value of attribute pattern.
25 26 27 |
# File 'app/models/docs/routes_collection.rb', line 25 def pattern @pattern end |
#reqs ⇒ Object
Returns the value of attribute reqs.
25 26 27 |
# File 'app/models/docs/routes_collection.rb', line 25 def reqs @reqs end |
#via ⇒ Object
Returns the value of attribute via.
25 26 27 |
# File 'app/models/docs/routes_collection.rb', line 25 def via @via end |
Instance Method Details
#inspect ⇒ Object
39 40 41 |
# File 'app/models/docs/routes_collection.rb', line 39 def inspect "#{via} #{path} => #{reqs}" end |
#to_page_attributes ⇒ Object
35 36 37 |
# File 'app/models/docs/routes_collection.rb', line 35 def to_page_attributes { path: path, via: via, reqs: reqs, page_category_slug: controller[/^api\/(\w+)/, 1] } end |