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