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.
88 89 90 91 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 88 def initialize(name, docstring) @name = name @docstring = PuppetStrings::Yard::Util.scrub_string(docstring).tr("\n", ' ') end |
Instance Attribute Details
#docstring ⇒ Object (readonly)
Returns the value of attribute docstring.
83 84 85 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 83 def docstring @docstring end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
83 84 85 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 83 def name @name end |
Instance Method Details
#to_hash ⇒ Hash
Converts the feature to a hash representation.
95 96 97 98 99 100 |
# File 'lib/puppet-strings/yard/code_objects/type.rb', line 95 def to_hash hash = {} hash[:name] = name hash[:description] = docstring unless docstring.empty? hash end |