Class: RspecGenerateDoc::Decorators::Parameter
- Inherits:
-
Object
- Object
- RspecGenerateDoc::Decorators::Parameter
- Defined in:
- lib/rspec_generate_doc/decorators/parameter.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Parameter
constructor
A new instance of Parameter.
- #required_human ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Parameter
Returns a new instance of Parameter.
6 7 8 9 10 11 |
# File 'lib/rspec_generate_doc/decorators/parameter.rb', line 6 def initialize(data = {}) @name = data[:name] || data['name'] @required = data[:required] || data['required'] @description = data[:description] || data['description'] || name || '' @options = OpenStruct.new(data[:options] || data['options'] || {}) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/rspec_generate_doc/decorators/parameter.rb', line 4 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/rspec_generate_doc/decorators/parameter.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/rspec_generate_doc/decorators/parameter.rb', line 4 def @options end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
4 5 6 |
# File 'lib/rspec_generate_doc/decorators/parameter.rb', line 4 def required @required end |
Instance Method Details
#required_human ⇒ Object
13 14 15 16 |
# File 'lib/rspec_generate_doc/decorators/parameter.rb', line 13 def required_human return required unless !!required == required required ? I18n.t(:required_yes, scope: :rspec_api_docs) : I18n.t(:required_no, scope: :rspec_api_docs) end |