class Puppet::Pops::Model::IfExpression
Attributes
else_expr[R]
test[R]
then_expr[R]
Public Class Methods
_pcore_type()
click to toggle source
# File lib/puppet/pops/model/ast.rb 2814 def self._pcore_type 2815 @_pcore_type ||= Types::PObjectType.new('Puppet::AST::IfExpression', { 2816 'parent' => Expression._pcore_type, 2817 'attributes' => { 2818 'test' => Expression._pcore_type, 2819 'then_expr' => { 2820 'type' => Types::POptionalType.new(Expression._pcore_type), 2821 'value' => nil 2822 }, 2823 'else_expr' => { 2824 'type' => Types::POptionalType.new(Expression._pcore_type), 2825 'value' => nil 2826 } 2827 } 2828 }) 2829 end
create(locator, offset, length, test, then_expr = nil, else_expr = nil)
click to toggle source
# File lib/puppet/pops/model/ast.rb 2845 def self.create(locator, offset, length, test, then_expr = nil, else_expr = nil) 2846 ta = Types::TypeAsserter 2847 attrs = _pcore_type.attributes(true) 2848 ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) 2849 ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) 2850 ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) 2851 ta.assert_instance_of('Puppet::AST::IfExpression[test]', attrs['test'].type, test) 2852 ta.assert_instance_of('Puppet::AST::IfExpression[then_expr]', attrs['then_expr'].type, then_expr) 2853 ta.assert_instance_of('Puppet::AST::IfExpression[else_expr]', attrs['else_expr'].type, else_expr) 2854 new(locator, offset, length, test, then_expr, else_expr) 2855 end
from_asserted_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 2835 def self.from_asserted_hash(init_hash) 2836 new( 2837 init_hash['locator'], 2838 init_hash['offset'], 2839 init_hash['length'], 2840 init_hash['test'], 2841 init_hash['then_expr'], 2842 init_hash['else_expr']) 2843 end
from_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 2831 def self.from_hash(init_hash) 2832 from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::IfExpression initializer', _pcore_type.init_hash_type, init_hash)) 2833 end
new(locator, offset, length, test, then_expr = nil, else_expr = nil)
click to toggle source
Calls superclass method
Puppet::Pops::Model::Positioned::new
# File lib/puppet/pops/model/ast.rb 2861 def initialize(locator, offset, length, test, then_expr = nil, else_expr = nil) 2862 super(locator, offset, length) 2863 @hash = @hash ^ test.hash ^ then_expr.hash ^ else_expr.hash 2864 @test = test 2865 @then_expr = then_expr 2866 @else_expr = else_expr 2867 end
Public Instance Methods
_pcore_all_contents(path, &block)
click to toggle source
# File lib/puppet/pops/model/ast.rb 2883 def _pcore_all_contents(path, &block) 2884 path << self 2885 unless @test.nil? 2886 block.call(@test, path) 2887 @test._pcore_all_contents(path, &block) 2888 end 2889 unless @then_expr.nil? 2890 block.call(@then_expr, path) 2891 @then_expr._pcore_all_contents(path, &block) 2892 end 2893 unless @else_expr.nil? 2894 block.call(@else_expr, path) 2895 @else_expr._pcore_all_contents(path, &block) 2896 end 2897 path.pop 2898 end
_pcore_contents() { |test| ... }
click to toggle source
# File lib/puppet/pops/model/ast.rb 2877 def _pcore_contents 2878 yield(@test) unless @test.nil? 2879 yield(@then_expr) unless @then_expr.nil? 2880 yield(@else_expr) unless @else_expr.nil? 2881 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 2869 def _pcore_init_hash 2870 result = super 2871 result['test'] = @test 2872 result['then_expr'] = @then_expr unless @then_expr == nil 2873 result['else_expr'] = @else_expr unless @else_expr == nil 2874 result 2875 end
eql?(o)
click to toggle source
Calls superclass method
Puppet::Pops::Model::PopsObject#eql?
# File lib/puppet/pops/model/ast.rb 2900 def eql?(o) 2901 super && 2902 @test.eql?(o.test) && 2903 @then_expr.eql?(o.then_expr) && 2904 @else_expr.eql?(o.else_expr) 2905 end
Also aliased as: ==