Class: JaxrsDoc::Resource
- Inherits:
-
Object
- Object
- JaxrsDoc::Resource
- Includes:
- Comparable
- Defined in:
- lib/annotations.rb
Instance Attribute Summary collapse
-
#consumes ⇒ Object
readonly
Returns the value of attribute consumes.
-
#deletes ⇒ Object
readonly
Returns the value of attribute deletes.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#gets ⇒ Object
readonly
Returns the value of attribute gets.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params_descriptions ⇒ Object
readonly
Returns the value of attribute params_descriptions.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#posts ⇒ Object
readonly
Returns the value of attribute posts.
-
#puts ⇒ Object
readonly
Returns the value of attribute puts.
-
#verbs ⇒ Object
readonly
Returns the value of attribute verbs.
Instance Method Summary collapse
- #<=>(another) ⇒ Object
- #add_param_description(param_description) ⇒ Object
-
#get_binding ⇒ Object
Support ERB templating of member data.
-
#initialize(file_name, type_annotations, verbs_annotations = {}, type_description = nil, params_descriptions = {}) ⇒ Resource
constructor
A new instance of Resource.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(file_name, type_annotations, verbs_annotations = {}, type_description = nil, params_descriptions = {}) ⇒ Resource
Returns a new instance of Resource.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/annotations.rb', line 8 def initialize(file_name, type_annotations, verbs_annotations = {}, type_description = nil, params_descriptions = {}) @name = file_name @description = type_description @params_descriptions = params_descriptions @path = type_annotations.annotations.find {|a| a.name.eql?"Path"} @consumes = type_annotations.annotations.find {|a| a.name.eql?"Consumes"} @gets = verbs_annotations[:gets] @posts = verbs_annotations[:posts] @puts = verbs_annotations[:puts] @deletes = verbs_annotations[:deletes] @verbs = verbs_annotations end |
Instance Attribute Details
#consumes ⇒ Object (readonly)
Returns the value of attribute consumes.
6 7 8 |
# File 'lib/annotations.rb', line 6 def consumes @consumes end |
#deletes ⇒ Object (readonly)
Returns the value of attribute deletes.
6 7 8 |
# File 'lib/annotations.rb', line 6 def deletes @deletes end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/annotations.rb', line 6 def description @description end |
#gets ⇒ Object (readonly)
Returns the value of attribute gets.
6 7 8 |
# File 'lib/annotations.rb', line 6 def gets @gets end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/annotations.rb', line 6 def name @name end |
#params_descriptions ⇒ Object (readonly)
Returns the value of attribute params_descriptions.
6 7 8 |
# File 'lib/annotations.rb', line 6 def params_descriptions @params_descriptions end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/annotations.rb', line 6 def path @path end |
#posts ⇒ Object (readonly)
Returns the value of attribute posts.
6 7 8 |
# File 'lib/annotations.rb', line 6 def posts @posts end |
#puts ⇒ Object (readonly)
Returns the value of attribute puts.
6 7 8 |
# File 'lib/annotations.rb', line 6 def puts @puts end |
#verbs ⇒ Object (readonly)
Returns the value of attribute verbs.
6 7 8 |
# File 'lib/annotations.rb', line 6 def verbs @verbs end |
Instance Method Details
#<=>(another) ⇒ Object
29 30 31 |
# File 'lib/annotations.rb', line 29 def <=>(another) path.value <=> another.path.value end |
#add_param_description(param_description) ⇒ Object
25 26 27 |
# File 'lib/annotations.rb', line 25 def add_param_description(param_description) @params_descriptions.update(param_description) end |
#get_binding ⇒ Object
Support ERB templating of member data.
38 39 40 |
# File 'lib/annotations.rb', line 38 def get_binding binding end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/annotations.rb', line 33 def to_s "#{@name} [#{@path.value}]" end |
#valid? ⇒ Boolean
21 22 23 |
# File 'lib/annotations.rb', line 21 def valid? not @path.nil? end |