Class: PuppetStrings::Yard::Parsers::Puppet::DataTypeAliasStatement
- Inherits:
-
Statement
- Object
- Statement
- PuppetStrings::Yard::Parsers::Puppet::DataTypeAliasStatement
- Defined in:
- lib/puppet-strings/yard/parsers/puppet/statement.rb
Overview
Implements the Puppet data type alias statement.
Constant Summary
Constants inherited from Statement
Instance Attribute Summary collapse
-
#alias_of ⇒ Object
readonly
Returns the value of attribute alias_of.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Statement
#comments_range, #docstring, #file, #line, #source
Instance Method Summary collapse
-
#initialize(object, file) ⇒ DataTypeAliasStatement
constructor
Initializes the Puppet data type alias statement.
Methods inherited from Statement
#comments, #comments_hash_flag, #extract_docstring, #show
Constructor Details
#initialize(object, file) ⇒ DataTypeAliasStatement
Initializes the Puppet data type alias statement.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 166 def initialize(object, file) super type_expr = object.type_expr case type_expr when Puppet::Pops::Model::AccessExpression # TODO: I don't like rebuilding the source from the AST, but AccessExpressions don't expose the original source @alias_of = +"#{PuppetStrings::Yard::Util.ast_to_text(type_expr.left_expr)}[" # alias_of should be mutable so we add a + to the string. @alias_of << type_expr.keys.map { |key| PuppetStrings::Yard::Util.ast_to_text(key) }.join(', ') @alias_of << ']' else @alias_of = PuppetStrings::Yard::Util.ast_to_text(type_expr) end @name = object.name end |
Instance Attribute Details
#alias_of ⇒ Object (readonly)
Returns the value of attribute alias_of.
161 162 163 |
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 161 def alias_of @alias_of end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
161 162 163 |
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 161 def name @name end |