class Puppet::Pops::Model::FunctionDefinition
Attributes
return_type[R]
Public Class Methods
_pcore_type()
click to toggle source
# File lib/puppet/pops/model/ast.rb 1948 def self._pcore_type 1949 @_pcore_type ||= Types::PObjectType.new('Puppet::AST::FunctionDefinition', { 1950 'parent' => NamedDefinition._pcore_type, 1951 'attributes' => { 1952 'return_type' => { 1953 'type' => Types::POptionalType.new(Expression._pcore_type), 1954 'value' => nil 1955 } 1956 } 1957 }) 1958 end
create(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil, return_type = nil)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1975 def self.create(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil, return_type = nil) 1976 ta = Types::TypeAsserter 1977 attrs = _pcore_type.attributes(true) 1978 ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) 1979 ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) 1980 ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) 1981 ta.assert_instance_of('Puppet::AST::NamedDefinition[name]', attrs['name'].type, name) 1982 ta.assert_instance_of('Puppet::AST::NamedDefinition[parameters]', attrs['parameters'].type, parameters) 1983 ta.assert_instance_of('Puppet::AST::NamedDefinition[body]', attrs['body'].type, body) 1984 ta.assert_instance_of('Puppet::AST::FunctionDefinition[return_type]', attrs['return_type'].type, return_type) 1985 new(locator, offset, length, name, parameters, body, return_type) 1986 end
from_asserted_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1964 def self.from_asserted_hash(init_hash) 1965 new( 1966 init_hash['locator'], 1967 init_hash['offset'], 1968 init_hash['length'], 1969 init_hash['name'], 1970 init_hash.fetch('parameters') { _pcore_type['parameters'].value }, 1971 init_hash['body'], 1972 init_hash['return_type']) 1973 end
from_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 1960 def self.from_hash(init_hash) 1961 from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::FunctionDefinition initializer', _pcore_type.init_hash_type, init_hash)) 1962 end
new(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil, return_type = nil)
click to toggle source
Calls superclass method
Puppet::Pops::Model::NamedDefinition::new
# File lib/puppet/pops/model/ast.rb 1990 def initialize(locator, offset, length, name, parameters = _pcore_type['parameters'].value, body = nil, return_type = nil) 1991 super(locator, offset, length, name, parameters, body) 1992 @hash = @hash ^ return_type.hash 1993 @return_type = return_type 1994 end
Public Instance Methods
_pcore_all_contents(path, &block)
click to toggle source
# File lib/puppet/pops/model/ast.rb 2008 def _pcore_all_contents(path, &block) 2009 path << self 2010 @parameters.each do |value| 2011 block.call(value, path) 2012 value._pcore_all_contents(path, &block) 2013 end 2014 unless @body.nil? 2015 block.call(@body, path) 2016 @body._pcore_all_contents(path, &block) 2017 end 2018 unless @return_type.nil? 2019 block.call(@return_type, path) 2020 @return_type._pcore_all_contents(path, &block) 2021 end 2022 path.pop 2023 end
_pcore_contents() { |value| ... }
click to toggle source
# File lib/puppet/pops/model/ast.rb 2002 def _pcore_contents 2003 @parameters.each { |value| yield(value) } 2004 yield(@body) unless @body.nil? 2005 yield(@return_type) unless @return_type.nil? 2006 end
_pcore_init_hash()
click to toggle source
Calls superclass method
Puppet::Pops::Model::NamedDefinition#_pcore_init_hash
# File lib/puppet/pops/model/ast.rb 1996 def _pcore_init_hash 1997 result = super 1998 result['return_type'] = @return_type unless @return_type == nil 1999 result 2000 end
eql?(o)
click to toggle source
Calls superclass method
Puppet::Pops::Model::NamedDefinition#eql?
# File lib/puppet/pops/model/ast.rb 2025 def eql?(o) 2026 super && 2027 @return_type.eql?(o.return_type) 2028 end
Also aliased as: ==