class PuppetStrings::Yard::Parsers::Puppet::DataTypeAliasStatement
Implements the Puppet
data type alias statement.
Attributes
alias_of[R]
name[R]
Public Class Methods
new(object, file)
click to toggle source
Initializes the Puppet
data type alias statement. @param [Puppet::Pops::Model::TypeAlias] object The model object for the type statement. @param [String] file The file containing the statement.
Calls superclass method
PuppetStrings::Yard::Parsers::Puppet::Statement::new
# 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