Class: PuppetStrings::Yard::CodeObjects::DataTypeAlias

Inherits:
Base
  • Object
show all
Defined in:
lib/puppet-strings/yard/code_objects/data_type_alias.rb

Overview

Implements the Puppet DataTypeAlias code object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

new

Constructor Details

#initialize(statement) ⇒ void

Initializes a Puppet data type alias code object.

Parameters:

  • statement (PuppetStrings::Parsers::DataTypeAliasStatement)

    The data type alias statement that was parsed.



30
31
32
33
34
# File 'lib/puppet-strings/yard/code_objects/data_type_alias.rb', line 30

def initialize(statement)
  @statement = statement
  @alias_of = statement.alias_of
  super(PuppetStrings::Yard::CodeObjects::DataTypeAliases.instance, statement.name)
end

Instance Attribute Details

#alias_ofObject

Returns the value of attribute alias_of.



25
26
27
# File 'lib/puppet-strings/yard/code_objects/data_type_alias.rb', line 25

def alias_of
  @alias_of
end

#statementObject (readonly)

Returns the value of attribute statement.



24
25
26
# File 'lib/puppet-strings/yard/code_objects/data_type_alias.rb', line 24

def statement
  @statement
end

Instance Method Details

#sourceObject

Gets the source of the code object.

Returns:

  • Returns the source of the code object.



44
45
46
47
# File 'lib/puppet-strings/yard/code_objects/data_type_alias.rb', line 44

def source
  # Not implemented, but would be nice!
  nil
end

#to_hashHash

Converts the code object to a hash representation.

Returns:

  • (Hash)

    Returns a hash representation of the code object.



51
52
53
54
55
56
57
58
59
# File 'lib/puppet-strings/yard/code_objects/data_type_alias.rb', line 51

def to_hash
  hash = {}
  hash[:name] = name
  hash[:file] = file
  hash[:line] = line
  hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
  hash[:alias_of] = alias_of
  hash
end

#typeObject

Gets the type of the code object.

Returns:

  • Returns the type of the code object.



38
39
40
# File 'lib/puppet-strings/yard/code_objects/data_type_alias.rb', line 38

def type
  :puppet_data_type_alias
end