class Puppet::Pops::Model::BinaryExpression

Attributes

left_expr[R]
right_expr[R]

Public Class Methods

_pcore_type() click to toggle source
    # File lib/puppet/pops/model/ast.rb
147 def self._pcore_type
148   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::BinaryExpression', {
149     'parent' => Expression._pcore_type,
150     'attributes' => {
151       'left_expr' => Expression._pcore_type,
152       'right_expr' => Expression._pcore_type
153     }
154   })
155 end
create(locator, offset, length, left_expr, right_expr) click to toggle source
    # File lib/puppet/pops/model/ast.rb
170 def self.create(locator, offset, length, left_expr, right_expr)
171   ta = Types::TypeAsserter
172   attrs = _pcore_type.attributes(true)
173   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
174   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
175   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
176   ta.assert_instance_of('Puppet::AST::BinaryExpression[left_expr]', attrs['left_expr'].type, left_expr)
177   ta.assert_instance_of('Puppet::AST::BinaryExpression[right_expr]', attrs['right_expr'].type, right_expr)
178   new(locator, offset, length, left_expr, right_expr)
179 end
from_asserted_hash(init_hash) click to toggle source
    # File lib/puppet/pops/model/ast.rb
161 def self.from_asserted_hash(init_hash)
162   new(
163     init_hash['locator'],
164     init_hash['offset'],
165     init_hash['length'],
166     init_hash['left_expr'],
167     init_hash['right_expr'])
168 end
from_hash(init_hash) click to toggle source
    # File lib/puppet/pops/model/ast.rb
157 def self.from_hash(init_hash)
158   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::BinaryExpression initializer', _pcore_type.init_hash_type, init_hash))
159 end
new(locator, offset, length, left_expr, right_expr) click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned::new
    # File lib/puppet/pops/model/ast.rb
184 def initialize(locator, offset, length, left_expr, right_expr)
185   super(locator, offset, length)
186   @hash = @hash ^ left_expr.hash ^ right_expr.hash
187   @left_expr = left_expr
188   @right_expr = right_expr
189 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
    # File lib/puppet/pops/model/ast.rb
203 def _pcore_all_contents(path, &block)
204   path << self
205   unless @left_expr.nil?
206     block.call(@left_expr, path)
207     @left_expr._pcore_all_contents(path, &block)
208   end
209   unless @right_expr.nil?
210     block.call(@right_expr, path)
211     @right_expr._pcore_all_contents(path, &block)
212   end
213   path.pop
214 end
_pcore_contents() { |left_expr| ... } click to toggle source
    # File lib/puppet/pops/model/ast.rb
198 def _pcore_contents
199   yield(@left_expr) unless @left_expr.nil?
200   yield(@right_expr) unless @right_expr.nil?
201 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
191 def _pcore_init_hash
192   result = super
193   result['left_expr'] = @left_expr
194   result['right_expr'] = @right_expr
195   result
196 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
    # File lib/puppet/pops/model/ast.rb
216 def eql?(o)
217   super &&
218   @left_expr.eql?(o.left_expr) &&
219   @right_expr.eql?(o.right_expr)
220 end
Also aliased as: ==