class Puppet::Pops::Model::NamedDefinition
Attributes
body[R]
name[R]
parameters[R]
Public Class Methods
_pcore_type()
click to toggle source
# File lib/puppet/pops/model/ast.rb 1858 def self._pcore_type 1859 @_pcore_type ||= Types::PObjectType.new('Puppet::AST::NamedDefinition', { 1860 'parent' => Definition._pcore_type, 1861 'attributes' => { 1862 'name' => Types::PStringType::DEFAULT, 1863 'parameters' => { 1864 'type' => Types::PArrayType.new(Parameter._pcore_type), 1865 'value' => [] 1866 }, 1867 'body' => { 1868 'type' => Types::POptionalType.new(Expression._pcore_type), 1869 'value' => nil 1870 } 1871 } 1872 }) 1873 end
create(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1889 def self.create(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil) 1890 ta = Types::TypeAsserter 1891 attrs = _pcore_type.attributes(true) 1892 ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) 1893 ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) 1894 ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) 1895 ta.assert_instance_of('Puppet::AST::NamedDefinition[name]', attrs['name'].type, name) 1896 ta.assert_instance_of('Puppet::AST::NamedDefinition[parameters]', attrs['parameters'].type, parameters) 1897 ta.assert_instance_of('Puppet::AST::NamedDefinition[body]', attrs['body'].type, body) 1898 new(locator, offset, length, name, parameters, body) 1899 end
from_asserted_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1879 def self.from_asserted_hash(init_hash) 1880 new( 1881 init_hash['locator'], 1882 init_hash['offset'], 1883 init_hash['length'], 1884 init_hash['name'], 1885 init_hash.fetch('parameters') { _pcore_type['parameters'].value }, 1886 init_hash['body']) 1887 end
from_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1875 def self.from_hash(init_hash) 1876 from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::NamedDefinition initializer', _pcore_type.init_hash_type, init_hash)) 1877 end
new(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil)
click to toggle source
Calls superclass method
Puppet::Pops::Model::Positioned::new
# File lib/puppet/pops/model/ast.rb 1905 def initialize(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil) 1906 super(locator, offset, length) 1907 @hash = @hash ^ name.hash ^ parameters.hash ^ body.hash 1908 @name = name 1909 @parameters = parameters 1910 @body = body 1911 end
Public Instance Methods
_pcore_all_contents(path, &block)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1926 def _pcore_all_contents(path, &block) 1927 path << self 1928 @parameters.each do |value| 1929 block.call(value, path) 1930 value._pcore_all_contents(path, &block) 1931 end 1932 unless @body.nil? 1933 block.call(@body, path) 1934 @body._pcore_all_contents(path, &block) 1935 end 1936 path.pop 1937 end
_pcore_contents() { |value| ... }
click to toggle source
# File lib/puppet/pops/model/ast.rb 1921 def _pcore_contents 1922 @parameters.each { |value| yield(value) } 1923 yield(@body) unless @body.nil? 1924 end
_pcore_init_hash()
click to toggle source
Calls superclass method
Puppet::Pops::Model::Positioned#_pcore_init_hash
# File lib/puppet/pops/model/ast.rb 1913 def _pcore_init_hash 1914 result = super 1915 result['name'] = @name 1916 result['parameters'] = @parameters unless _pcore_type['parameters'].default_value?(@parameters) 1917 result['body'] = @body unless @body == nil 1918 result 1919 end
eql?(o)
click to toggle source
Calls superclass method
Puppet::Pops::Model::PopsObject#eql?
# File lib/puppet/pops/model/ast.rb 1939 def eql?(o) 1940 super && 1941 @name.eql?(o.name) && 1942 @parameters.eql?(o.parameters) && 1943 @body.eql?(o.body) 1944 end
Also aliased as: ==