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.
83 84 85 86 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 83 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.
78 79 80 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 78 def docstring @docstring end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
78 79 80 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 78 def name @name end |
Instance Method Details
#to_hash ⇒ Hash
Converts the feature to a hash representation.
90 91 92 93 94 95 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 90 def to_hash hash = {} hash[:name] = name hash[:description] = docstring unless docstring.empty? hash end |