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.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 180 def initialize(object, file) super(object, file) 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 = ::Puppet::Pops::Adapters::SourcePosAdapter.adapt(type_expr.left_expr).extract_text + '[' @alias_of << type_expr.keys.map { |key| ::Puppet::Pops::Adapters::SourcePosAdapter.adapt(key).extract_text }.join(', ') @alias_of << ']' else adapter = ::Puppet::Pops::Adapters::SourcePosAdapter.adapt(type_expr) @alias_of = adapter.extract_text end @name = object.name end |
Instance Attribute Details
#alias_of ⇒ Object (readonly)
Returns the value of attribute alias_of.
175 176 177 |
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 175 def alias_of @alias_of end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
174 175 176 |
# File 'lib/puppet-strings/yard/parsers/puppet/statement.rb', line 174 def name @name end |