Class: PuppetStrings::Yard::CodeObjects::Type::Feature
- Inherits:
-
Object
- Object
- PuppetStrings::Yard::CodeObjects::Type::Feature
- Defined in:
- lib/puppet-strings/yard/code_objects/type.rb
Overview
Represents a resource type feature.
Instance Attribute Summary collapse
-
#docstring ⇒ Object
readonly
Returns the value of attribute docstring.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, docstring) ⇒ Feature
constructor
Initializes a new feature.
-
#to_hash ⇒ Hash
Converts the feature to a hash representation.
Constructor Details
#initialize(name, docstring) ⇒ Feature
Initializes a new feature.
82 83 84 85 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 82 def initialize(name, docstring) @name = name @docstring = PuppetStrings::Yard::Util.scrub_string(docstring).gsub("\n", ' ') end |
Instance Attribute Details
#docstring ⇒ Object (readonly)
Returns the value of attribute docstring.
77 78 79 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 77 def docstring @docstring end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
77 78 79 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 77 def name @name end |
Instance Method Details
#to_hash ⇒ Hash
Converts the feature to a hash representation.
89 90 91 92 93 94 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 89 def to_hash hash = {} hash[:name] = name hash[:description] = docstring unless docstring.empty? hash end |