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