class Puppet::Pops::Model::ArithmeticExpression
Attributes
operator[R]
Public Class Methods
_pcore_type()
click to toggle source
# File lib/puppet/pops/model/ast.rb 451 def self._pcore_type 452 @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ArithmeticExpression', { 453 'parent' => BinaryExpression._pcore_type, 454 'attributes' => { 455 'operator' => Types::PEnumType.new(['%', '*', '+', '-', '/', '<<', '>>']) 456 } 457 }) 458 end
create(locator, offset, length, left_expr, right_expr, operator)
click to toggle source
# File lib/puppet/pops/model/ast.rb 474 def self.create(locator, offset, length, left_expr, right_expr, operator) 475 ta = Types::TypeAsserter 476 attrs = _pcore_type.attributes(true) 477 ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) 478 ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) 479 ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) 480 ta.assert_instance_of('Puppet::AST::BinaryExpression[left_expr]', attrs['left_expr'].type, left_expr) 481 ta.assert_instance_of('Puppet::AST::BinaryExpression[right_expr]', attrs['right_expr'].type, right_expr) 482 ta.assert_instance_of('Puppet::AST::ArithmeticExpression[operator]', attrs['operator'].type, operator) 483 new(locator, offset, length, left_expr, right_expr, operator) 484 end
from_asserted_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 464 def self.from_asserted_hash(init_hash) 465 new( 466 init_hash['locator'], 467 init_hash['offset'], 468 init_hash['length'], 469 init_hash['left_expr'], 470 init_hash['right_expr'], 471 init_hash['operator']) 472 end
from_hash(init_hash)
click to toggle source
# File lib/puppet/pops/model/ast.rb 460 def self.from_hash(init_hash) 461 from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ArithmeticExpression initializer', _pcore_type.init_hash_type, init_hash)) 462 end
new(locator, offset, length, left_expr, right_expr, operator)
click to toggle source
Calls superclass method
Puppet::Pops::Model::BinaryExpression::new
# File lib/puppet/pops/model/ast.rb 488 def initialize(locator, offset, length, left_expr, right_expr, operator) 489 super(locator, offset, length, left_expr, right_expr) 490 @hash = @hash ^ operator.hash 491 @operator = operator 492 end
Public Instance Methods
_pcore_all_contents(path, &block)
click to toggle source
# File lib/puppet/pops/model/ast.rb 505 def _pcore_all_contents(path, &block) 506 path << self 507 unless @left_expr.nil? 508 block.call(@left_expr, path) 509 @left_expr._pcore_all_contents(path, &block) 510 end 511 unless @right_expr.nil? 512 block.call(@right_expr, path) 513 @right_expr._pcore_all_contents(path, &block) 514 end 515 path.pop 516 end
_pcore_contents() { |left_expr| ... }
click to toggle source
# File lib/puppet/pops/model/ast.rb 500 def _pcore_contents 501 yield(@left_expr) unless @left_expr.nil? 502 yield(@right_expr) unless @right_expr.nil? 503 end
_pcore_init_hash()
click to toggle source
Calls superclass method
Puppet::Pops::Model::BinaryExpression#_pcore_init_hash
# File lib/puppet/pops/model/ast.rb 494 def _pcore_init_hash 495 result = super 496 result['operator'] = @operator 497 result 498 end
eql?(o)
click to toggle source
Calls superclass method
Puppet::Pops::Model::BinaryExpression#eql?
# File lib/puppet/pops/model/ast.rb 518 def eql?(o) 519 super && 520 @operator.eql?(o.operator) 521 end
Also aliased as: ==