Sha256: f6780a13ad0f010533c7e8afd8bba91bbc343800dc9a2f70379d8c535d0f9b65
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
module Dox module Entities class Action attr_reader :name, :desc, :verb, :path, :uri_params attr_accessor :examples def initialize(name, details, request) @request = request @name = name @desc = details[:action_desc] @verb = details[:action_verb] || request.method @path = details[:action_path] || template_path @uri_params = details[:action_params] @examples = [] end private attr_reader :request def template_path path_params = request.path_parameters.symbolize_keys.except(:action, :controller) path = request.path.dup path_params.each do |key, value| # /pokemons/1 => pokemons/{id} path.sub!(/\/#{value}(\/|$)/, "/{#{key}}\\1") end path end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dox-1.0.0.alpha | lib/dox/entities/action.rb |