class Puppet::Pops::Model::ComparisonExpression

Attributes

operator[R]

Public Class Methods

_pcore_type() click to toggle source
    # File lib/puppet/pops/model/ast.rb
682 def self._pcore_type
683   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ComparisonExpression', {
684     'parent' => BinaryExpression._pcore_type,
685     'attributes' => {
686       'operator' => Types::PEnumType.new(['!=', '<', '<=', '==', '>', '>='])
687     }
688   })
689 end
create(locator, offset, length, left_expr, right_expr, operator) click to toggle source
    # File lib/puppet/pops/model/ast.rb
705 def self.create(locator, offset, length, left_expr, right_expr, operator)
706   ta = Types::TypeAsserter
707   attrs = _pcore_type.attributes(true)
708   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
709   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
710   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
711   ta.assert_instance_of('Puppet::AST::BinaryExpression[left_expr]', attrs['left_expr'].type, left_expr)
712   ta.assert_instance_of('Puppet::AST::BinaryExpression[right_expr]', attrs['right_expr'].type, right_expr)
713   ta.assert_instance_of('Puppet::AST::ComparisonExpression[operator]', attrs['operator'].type, operator)
714   new(locator, offset, length, left_expr, right_expr, operator)
715 end
from_asserted_hash(init_hash) click to toggle source
    # File lib/puppet/pops/model/ast.rb
695 def self.from_asserted_hash(init_hash)
696   new(
697     init_hash['locator'],
698     init_hash['offset'],
699     init_hash['length'],
700     init_hash['left_expr'],
701     init_hash['right_expr'],
702     init_hash['operator'])
703 end
from_hash(init_hash) click to toggle source
    # File lib/puppet/pops/model/ast.rb
691 def self.from_hash(init_hash)
692   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ComparisonExpression initializer', _pcore_type.init_hash_type, init_hash))
693 end
new(locator, offset, length, left_expr, right_expr, operator) click to toggle source
    # File lib/puppet/pops/model/ast.rb
719 def initialize(locator, offset, length, left_expr, right_expr, operator)
720   super(locator, offset, length, left_expr, right_expr)
721   @hash = @hash ^ operator.hash
722   @operator = operator
723 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
    # File lib/puppet/pops/model/ast.rb
736 def _pcore_all_contents(path, &block)
737   path << self
738   unless @left_expr.nil?
739     block.call(@left_expr, path)
740     @left_expr._pcore_all_contents(path, &block)
741   end
742   unless @right_expr.nil?
743     block.call(@right_expr, path)
744     @right_expr._pcore_all_contents(path, &block)
745   end
746   path.pop
747 end
_pcore_contents() { |left_expr| ... } click to toggle source
    # File lib/puppet/pops/model/ast.rb
731 def _pcore_contents
732   yield(@left_expr) unless @left_expr.nil?
733   yield(@right_expr) unless @right_expr.nil?
734 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
725 def _pcore_init_hash
726   result = super
727   result['operator'] = @operator
728   result
729 end
eql?(o) click to toggle source
    # File lib/puppet/pops/model/ast.rb
749 def eql?(o)
750   super &&
751   @operator.eql?(o.operator)
752 end
Also aliased as: ==