Class: Puppet::Pops::Model::ApplyExpression
- Inherits:
-
Expression
- Object
- PopsObject
- Positioned
- Expression
- Puppet::Pops::Model::ApplyExpression
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #arguments ⇒ Object readonly
- #body ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, arguments = _pcore_type['arguments'].value, body = nil) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@body| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, arguments = _pcore_type['arguments'].value, body = nil) ⇒ ApplyExpression
constructor
A new instance of ApplyExpression.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, arguments = _pcore_type['arguments'].value, body = nil) ⇒ ApplyExpression
Returns a new instance of ApplyExpression.
2964 2965 2966 2967 2968 2969 |
# File 'lib/puppet/pops/model/ast.rb', line 2964 def initialize(locator, offset, length, arguments = _pcore_type['arguments'].value, body = nil) super(locator, offset, length) @hash = @hash ^ arguments.hash ^ body.hash @arguments = arguments @body = body end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
2961 2962 2963 |
# File 'lib/puppet/pops/model/ast.rb', line 2961 def arguments @arguments end |
#body ⇒ Object (readonly)
2962 2963 2964 |
# File 'lib/puppet/pops/model/ast.rb', line 2962 def body @body end |
Class Method Details
._pcore_type ⇒ Object
2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 |
# File 'lib/puppet/pops/model/ast.rb', line 2921 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ApplyExpression', { 'parent' => Expression._pcore_type, 'attributes' => { 'arguments' => { 'type' => Types::PArrayType.new(Expression._pcore_type), 'value' => [] }, 'body' => { 'type' => Types::POptionalType.new(Expression._pcore_type), 'value' => nil } } }) end |
.create(locator, offset, length, arguments = _pcore_type['arguments'].value, body = nil) ⇒ Object
2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 |
# File 'lib/puppet/pops/model/ast.rb', line 2950 def self.create(locator, offset, length, arguments = _pcore_type['arguments'].value, body = nil) ta = Types::TypeAsserter attrs = _pcore_type.attributes(true) ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) ta.assert_instance_of('Puppet::AST::ApplyExpression[arguments]', attrs['arguments'].type, arguments) ta.assert_instance_of('Puppet::AST::ApplyExpression[body]', attrs['body'].type, body) new(locator, offset, length, arguments, body) end |
.from_asserted_hash(init_hash) ⇒ Object
2941 2942 2943 2944 2945 2946 2947 2948 |
# File 'lib/puppet/pops/model/ast.rb', line 2941 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash.fetch('arguments') { _pcore_type['arguments'].value }, init_hash['body']) end |
.from_hash(init_hash) ⇒ Object
2937 2938 2939 |
# File 'lib/puppet/pops/model/ast.rb', line 2937 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ApplyExpression initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 |
# File 'lib/puppet/pops/model/ast.rb', line 2983 def _pcore_all_contents(path, &block) path << self @arguments.each do |value| block.call(value, path) value._pcore_all_contents(path, &block) end unless @body.nil? block.call(@body, path) @body._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@body| ... } ⇒ Object
2978 2979 2980 2981 |
# File 'lib/puppet/pops/model/ast.rb', line 2978 def _pcore_contents @arguments.each { |value| yield(value) } yield(@body) unless @body.nil? end |
#_pcore_init_hash ⇒ Object
2971 2972 2973 2974 2975 2976 |
# File 'lib/puppet/pops/model/ast.rb', line 2971 def _pcore_init_hash result = super result['arguments'] = @arguments unless _pcore_type['arguments'].default_value?(@arguments) result['body'] = @body unless @body == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
2996 2997 2998 2999 3000 |
# File 'lib/puppet/pops/model/ast.rb', line 2996 def eql?(o) super && @arguments.eql?(o.arguments) && @body.eql?(o.body) end |